Ticket #13521: django1.2_inlines_js_max_num_comparison.patch

File django1.2_inlines_js_max_num_comparison.patch, 995 bytes (added by Rolando Espinoza La fuente, 14 years ago)
  • inlines.js

    old new  
    9595                                // Update number of total forms
    9696                                $(totalForms).val(nextIndex + 1);
    9797                                // 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) {
    9999                                        addButton.parent().hide();
    100100                                }
    101101                                // The delete button of each row triggers a bunch of other things
     
    111111                                        var forms = $("." + options.formCssClass);
    112112                                        $("#id_" + options.prefix + "-TOTAL_FORMS").val(forms.length);
    113113                                        // 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) {
    115115                                                addButton.parent().show();
    116116                                        }
    117117                                        // Also, update names and ids for all remaining form controls
Back to Top