Handle null checkboxes inside rows generated by "Continue insertion"

This commit is contained in:
Marc Delisle
2011-01-03 16:34:20 -05:00
parent 3a2e9d425f
commit 5bae920417

View File

@@ -9,7 +9,7 @@
*/ */
/** /**
* Modify from controls when the "NULL" checkbox is selected * Modify form controls when the "NULL" checkbox is checked
* *
* @param theType string the MySQL field type * @param theType string the MySQL field type
* @param urlField string the urlencoded field name - OBSOLETE * @param urlField string the urlencoded field name - OBSOLETE
@@ -243,7 +243,9 @@ $(document).ready(function() {
$('.foreign_values_anchor').show(); $('.foreign_values_anchor').show();
/** /**
* Handles all current checkboxes for Null * Handles all current checkboxes for Null; this only takes care of the
* checkboxes on currently displayed rows as the rows generated by
* "Continue insertion" are handled in the "Continue insertion" code
* *
*/ */
$('.checkbox_null').bind('click', function(e) { $('.checkbox_null').bind('click', function(e) {
@@ -407,12 +409,20 @@ $(document).ready(function() {
if ($this_element.is('.checkbox_null')) { if ($this_element.is('.checkbox_null')) {
$this_element $this_element
// this event was bound earlier by jQuery but
// to the original row, not the cloned one, so unbind()
.unbind('click')
// Keep these values to be used when the element
// will be clicked
.data('hashed_field', hashed_field)
.data('new_row_index', new_row_index)
.bind('click', function(e) { .bind('click', function(e) {
var $changed_element = $(this);
nullify( nullify(
$this_element.siblings('.nullify_code').val(), $changed_element.siblings('.nullify_code').val(),
$this_element.closest('tr').find('input:hidden').first().val(), $this_element.closest('tr').find('input:hidden').first().val(),
hashed_field, $changed_element.data('hashed_field'),
'[multi_edit][' + new_row_index + ']' '[multi_edit][' + $changed_element.data('new_row_index') + ']'
); );
}); });
} }