diff --git a/gp-nested-forms/gpnf-limit-entry-min-max-from-field.php b/gp-nested-forms/gpnf-limit-entry-min-max-from-field.php index 7eced271c..3eb64fe02 100644 --- a/gp-nested-forms/gpnf-limit-entry-min-max-from-field.php +++ b/gp-nested-forms/gpnf-limit-entry-min-max-from-field.php @@ -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 ) ); @@ -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; }); @@ -215,4 +221,4 @@ public function should_field_be_validated( $form, $field ) { return true; } -} +} \ No newline at end of file