Permalink
Browse files

Fixed #13521 -- Corrected javascript comparisons determining when to …

…show and hide the 'add another' inline button. Thanks to darkrho for the report and patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@13234 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent 6543539 commit 16c64bc2b723dad2db16db0f75c416ec30f964ad @freakboy3742 freakboy3742 committed May 11, 2010
Showing with 3 additions and 3 deletions.
  1. +2 −2 django/contrib/admin/media/js/inlines.js
  2. +1 −1 django/contrib/admin/media/js/inlines.min.js
@@ -95,7 +95,7 @@
// Update number of total forms
$(totalForms).val(nextIndex + 1);
// Hide add button in case we've hit the max, except we want to add infinitely
- if ((maxForms.val() != '') && (maxForms.val() <= totalForms.val())) {
+ if ((maxForms.val() != '') && (maxForms.val()-totalForms.val()) <= 0) {
addButton.parent().hide();
}
// The delete button of each row triggers a bunch of other things
@@ -111,7 +111,7 @@
var forms = $("." + options.formCssClass);
$("#id_" + options.prefix + "-TOTAL_FORMS").val(forms.length);
// Show add button again once we drop below max
- if ((maxForms.val() == '') || (maxForms.val() >= forms.length)) {
+ if ((maxForms.val() == '') || (maxForms.val()-forms.length) > 0) {
addButton.parent().show();
}
// Also, update names and ids for all remaining form controls

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

0 comments on commit 16c64bc

Please sign in to comment.