Lines 33-42
Link Here
|
33 |
} |
33 |
} |
34 |
|
34 |
|
35 |
// Sets the good number of form fields for the specified subfield |
35 |
// Sets the good number of form fields for the specified subfield |
|
|
36 |
// Returns false if the cloning failed |
36 |
function SetSubfieldNumber(subfield_name, nb) { |
37 |
function SetSubfieldNumber(subfield_name, nb) { |
37 |
// Nothing to do if we only have one value |
38 |
// Nothing to do if we only have one value |
38 |
if(nb <= 1) { |
39 |
if(nb <= 1) { |
39 |
return; |
40 |
return true; |
40 |
} |
41 |
} |
41 |
|
42 |
|
42 |
// Find the subfield we want to clone |
43 |
// Find the subfield we want to clone |
Lines 45-54
Link Here
|
45 |
return this.id.match(re); |
46 |
return this.id.match(re); |
46 |
}); |
47 |
}); |
47 |
|
48 |
|
48 |
// Add as many clones as needed |
49 |
// Try to add as many clones as needed |
49 |
for(var i=0; i<nb-subfields.length; i++) { |
50 |
try { |
50 |
window.opener.opener.CloneSubfield(subfields[0].getAttribute('id')); |
51 |
for(var i=0; i<nb-subfields.length; i++) { |
|
|
52 |
window.opener.opener.CloneSubfield(subfields[0].getAttribute('id')); |
53 |
} |
54 |
} |
55 |
catch(err) { |
56 |
return false; |
51 |
} |
57 |
} |
|
|
58 |
return true; |
52 |
} |
59 |
} |
53 |
|
60 |
|
54 |
// Fills the subfield with the values entered in argument |
61 |
// Fills the subfield with the values entered in argument |
Lines 61-66
Link Here
|
61 |
} |
68 |
} |
62 |
|
69 |
|
63 |
// Create the correct number of form fields for all values |
70 |
// Create the correct number of form fields for all values |
|
|
71 |
// If the field cloning failed, only the first value will be added to the form. |
64 |
SetSubfieldNumber(subfield_name, values.length); |
72 |
SetSubfieldNumber(subfield_name, values.length); |
65 |
|
73 |
|
66 |
// Find the subfields where we will add the new values |
74 |
// Find the subfields where we will add the new values |
67 |
- |
|
|