From 5bae920417fbc993a262e4e93af00f02ae225efe Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Mon, 3 Jan 2011 16:34:20 -0500 Subject: [PATCH] Handle null checkboxes inside rows generated by "Continue insertion" --- js/tbl_change.js | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/js/tbl_change.js b/js/tbl_change.js index 736317d09..ebd88ff2e 100644 --- a/js/tbl_change.js +++ b/js/tbl_change.js @@ -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 urlField string the urlencoded field name - OBSOLETE @@ -243,7 +243,9 @@ $(document).ready(function() { $('.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) { @@ -407,12 +409,20 @@ $(document).ready(function() { if ($this_element.is('.checkbox_null')) { $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) { + var $changed_element = $(this); nullify( - $this_element.siblings('.nullify_code').val(), + $changed_element.siblings('.nullify_code').val(), $this_element.closest('tr').find('input:hidden').first().val(), - hashed_field, - '[multi_edit][' + new_row_index + ']' + $changed_element.data('hashed_field'), + '[multi_edit][' + $changed_element.data('new_row_index') + ']' ); }); }