Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gp-nested-forms/gpnf-limit-entry-min-max-from-field.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public function output_script() {
var $maxField = $( '#' + maxFieldId );
var value = parseInt($maxField.val());

return value ? value : self.defaultMax;
return isNaN(value) ? Infinity : (value || self.defaultMax);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Logic improvement to prevent premature "maximum number reached" message.

The change correctly addresses the issue by checking if the parsed value is not a number (NaN) and returning Infinity in that case. This prevents the system from incorrectly defaulting to a maximum of 0 when the max field is empty, allowing users to add entries without encountering the premature "maximum number reached" message.

This fix resolves the critical issue described in the PR where users couldn't add child entries because the system was incorrectly displaying the maximum limit message when the form loaded.

});

gform.addAction( 'gform_input_change', function( el, formId, fieldId ) {
Expand Down
Loading