Ticket #13521: django1.2_inlines_js_max_num_comparison.patch
File django1.2_inlines_js_max_num_comparison.patch, 995 bytes (added by , 15 years ago) |
---|
-
inlines.js
old new 95 95 // Update number of total forms 96 96 $(totalForms).val(nextIndex + 1); 97 97 // Hide add button in case we've hit the max, except we want to add infinitely 98 if ((maxForms.val() != '') && (maxForms.val() <= totalForms.val())) {98 if ((maxForms.val() != '') && (maxForms.val()-totalForms.val()) <= 0) { 99 99 addButton.parent().hide(); 100 100 } 101 101 // The delete button of each row triggers a bunch of other things … … 111 111 var forms = $("." + options.formCssClass); 112 112 $("#id_" + options.prefix + "-TOTAL_FORMS").val(forms.length); 113 113 // Show add button again once we drop below max 114 if ((maxForms.val() == '') || (maxForms.val() >= forms.length)) {114 if ((maxForms.val() == '') || (maxForms.val()-forms.length) > 0) { 115 115 addButton.parent().show(); 116 116 } 117 117 // Also, update names and ids for all remaining form controls