Skip to content
Draft
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
14 changes: 10 additions & 4 deletions gp-nested-forms/gpnf-limit-entry-min-max-from-field.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ public function output_script() {

self.init = function () {

var attrReadyMaxFieldId = self.maxFieldId.replace( '.', '_' );
var maxFieldId = 'input_' + self.parentFormId + '_' + attrReadyMaxFieldId;
//var attrReadyMaxFieldId = self.maxFieldId.replace( '.', '_' );
var maxFieldId = 'input_' + self.parentFormId + '_' + self.maxFieldId;

// GF uses "1" for the input index in the HTML id attribute for Single Product fields. Weird.
var $maxField = $( '#input_' + self.parentFormId + '_' + parseInt( self.maxFieldId ) );
Expand All @@ -146,7 +146,13 @@ public function output_script() {
}

var $maxField = $( '#' + maxFieldId );
var value = parseInt($maxField.val());

// Getting values of Radio Choices works slightly differently
if ( $maxField.hasClass('gfield_radio') ){
var value = parseInt($("input[id^='choice_" + self.parentFormId + "_" + self.maxFieldId + "_']:checked").val());
} else {
var value = parseInt($maxField.val());
}

return value ? value : self.defaultMax;
});
Expand Down Expand Up @@ -215,4 +221,4 @@ public function should_field_be_validated( $form, $field ) {
return true;
}

}
}