Merge branch 'elarnon/fix-182' into 'master'
Properly propagate the default number of places in tirage Closes #182 See merge request cof-geek/gestioCOF!295
This commit is contained in:
commit
307c48ca76
1 changed files with 8 additions and 0 deletions
|
@ -27,6 +27,14 @@ var django = {
|
|||
var newFor = $(this).attr('for').replace('-' + (total-1) + '-','-' + total + '-');
|
||||
$(this).attr('for', newFor);
|
||||
});
|
||||
// Cloning <select> element doesn't properly propagate the default
|
||||
// selected <option>, so we set it manually.
|
||||
newElement.find('select').each(function (index, select) {
|
||||
var defaultValue = $(select).find('option[selected]').val();
|
||||
if (typeof defaultValue !== 'undefined') {
|
||||
$(select).val(defaultValue);
|
||||
}
|
||||
});
|
||||
total++;
|
||||
$('#id_' + type + '-TOTAL_FORMS').val(total);
|
||||
$(selector).after(newElement);
|
||||
|
|
Loading…
Reference in a new issue