@@ -60,8 +60,11 @@ public function validate( $validation_result ) {
6060 $ entry_ids = explode ( ', ' , $ nested_form_field_value );
6161 $ entry_count = empty ( $ nested_form_field_value ) ? 0 : count ( $ entry_ids );
6262
63- $ raw_min = rgpost ( "input_ {$ this ->_args ['min_field_id ' ]}" );
64- $ raw_max = rgpost ( "input_ {$ this ->_args ['max_field_id ' ]}" );
63+ $ min_field_id = str_replace ( '. ' , '_ ' , $ this ->_args ['min_field_id ' ] );
64+ $ max_field_id = str_replace ( '. ' , '_ ' , $ this ->_args ['max_field_id ' ] );
65+
66+ $ raw_min = rgpost ( "input_ {$ min_field_id }" );
67+ $ raw_max = rgpost ( "input_ {$ max_field_id }" );
6568
6669 if ( empty ( $ raw_min ) ) {
6770 $ raw_min = $ this ->_args ['default_min ' ];
@@ -128,7 +131,14 @@ public function output_script() {
128131
129132 self.init = function () {
130133
131- var maxFieldId = 'input_' + self.parentFormId + '_' + self.maxFieldId;
134+ var attrReadyMaxFieldId = self.maxFieldId.replace( '.', '_' );
135+ var maxFieldId = 'input_' + self.parentFormId + '_' + attrReadyMaxFieldId;
136+
137+ // GF uses "1" for the input index in the HTML id attribute for Single Product fields. Weird.
138+ var $maxField = $( '#input_' + self.parentFormId + '_' + parseInt( self.maxFieldId ) );
139+ if ( $maxField.parents( '.gfield' ).hasClass( 'gfield--input-type-singleproduct' ) ) {
140+ maxFieldId = 'input_' + self.parentFormId + '_' + parseInt( self.maxFieldId ) + '_1';
141+ }
132142
133143 gform.addFilter('gpnf_entry_limit_max', function (max, currentFormId, currentFieldId) {
134144 if (self.parentFormId != currentFormId || self.nestedFormFieldId != currentFieldId) {
0 commit comments