diff options
author | Marc Delisle <marc@infomarc.info> | 2014-09-15 16:02:47 +0400 |
---|---|---|
committer | Marc Delisle <marc@infomarc.info> | 2014-09-15 16:02:47 +0400 |
commit | f70744ad71b74831cc6142d26b0290f21d608a90 (patch) | |
tree | 25f936926929a283cf2e69dd6c23064692a6cb6a /js | |
parent | f9dd601397cd4a4a5684d287042c2e898aff9495 (diff) | |
parent | 41c02512c7af351231f4ec280e146eef597be2db (diff) |
Merge commit '41c0251'
Diffstat (limited to 'js')
-rw-r--r-- | js/tbl_change.js | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/js/tbl_change.js b/js/tbl_change.js index cc87711abe..f8002f24e1 100644 --- a/js/tbl_change.js +++ b/js/tbl_change.js @@ -397,20 +397,28 @@ AJAX.registerOnload('tbl_change.js', function () { * available). */ $('select[name="submit_type"]').bind('change', function (e) { + var thisElemSubmitTypeVal = $(this).val(); var $table = $('table.insertRowTable'); - var auto_increment_column = $table.find('input[name^="auto_increment"]').attr('name'); - if (auto_increment_column) { - var prev_value_field = $table.find('input[name="' + auto_increment_column.replace('auto_increment', 'fields_prev') + '"]'); - var value_field = $table.find('input[name="' + auto_increment_column.replace('auto_increment', 'fields') + '"]'); + var auto_increment_column = $table.find('input[name^="auto_increment"]'); + auto_increment_column.each(function () { + var $thisElemAIField = $(this); + var thisElemName = $thisElemAIField.attr('name'); + + var prev_value_field = $table.find('input[name="' + thisElemName.replace('auto_increment', 'fields_prev') + '"]'); + var value_field = $table.find('input[name="' + thisElemName.replace('auto_increment', 'fields') + '"]'); var previous_value = $(prev_value_field).val(); if (previous_value !== undefined) { - if ($(this).val() == 'insert' || $(this).val() == 'insertignore' || $(this).val() == 'showinsert') { + if (thisElemSubmitTypeVal == 'insert' + || thisElemSubmitTypeVal == 'insertignore' + || thisElemSubmitTypeVal == 'showinsert' + ) { $(value_field).val(0); } else { $(value_field).val(previous_value); } } - } + }); + }); /** |