You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When creating a select field and the first value for the select options is numerical (string or integer) the rendered HTML returns the option label instead of the set option value as the value.
To Reproduce
Create code for 2 multiple select fields, setting the first field's select option values all numerical and the for the second field set the first option to a string containing alphanumerical characters.
For Example:
functionmy_pmprorh_init_custom_registration_fields_1638785793517() {
// don't break if Register Helper is not loadedif ( ! function_exists( 'pmprorh_add_registration_field' ) ) {
returnfalse;
}
// definethefields$fields = array();
/* This field will only appear when checking out for the membershiplevelswithlevel ID 1, 3,or 5. */$fields[] = newPMProRH_Field(
'select_example', // input field name, used as metakey'select', // fieldtypearray(
'label' => 'Select example', // display custom label,if not used field name will be used'profile' => true, // show on profile'memberslistcsv' => true, // include when using export members to csv'addmember' => true, // include when using add member from admin'multiple' => true,
'options' => array(
'1' => 'Option One',
'2' => 'Option Two',
'3' => 'Option Three',
),
)
);
/*Rendered HTML:<selectid="select_example"name="select_example[]" class="input" multiple="multiple"><optionvalue="Option One">OptionOne</option><optionvalue="Option Two">OptionTwo</option><optionvalue="Option Three">Option Three</option> </select> */$fields[] = newPMProRH_Field(
'select_example_two', // input field name, used as metakey'select', // fieldtypearray(
'label' => 'Select example two', // display custom label,if not used field name will be used'profile' => true, // show on profile'memberslistcsv' => true, // include when using export members to csv'addmember' => true, // include when using add member from admin'multiple' => true,
'options' => array(
'option_1' => 'Option One',
'2' => 'Option Two',
'3' => 'Option Three',
),
)
);
/*Rendered HTML:<selectid="select_example_two"name="select_example_two[]" class="input" multiple="multiple"><optionvalue="option_1">OptionOne</option><optionvalue="2">OptionTwo</option><optionvalue="3">Option Three</option> </select> */foreach ( $fieldsas$field ) {
pmprorh_add_registration_field(
'checkout_boxes', // location on checkoutpage$field// PMProRH_Fieldobject
);
}
}
add_action( 'init', 'my_pmprorh_init_custom_registration_fields_1638785793517' );
Navigate to checkout page and inspect rendered HTML for these fields.
Screenshot 1
select_example Note the incorrect values for each option
Screenshot 2
select_example_two Note the correct values for each option.
Expected behavior
Values for each option of a select field rendered in HTML should be the same as in the field creation code snippet.
Isolating the problem (mark completed items with an [x]):
I have deactivated other plugins and confirmed this bug occurs when only Paid Memberships Pro plugin is active.
This bug happens with a default WordPress theme active, or Memberlite.
I can reproduce this bug consistently using the steps above.
The text was updated successfully, but these errors were encountered:
Describe the bug
When creating a select field and the first value for the select options is numerical (string or integer) the rendered HTML returns the option label instead of the set option value as the value.
To Reproduce
For Example:
Screenshot 1
select_example
Note the incorrect values for each optionScreenshot 2
select_example_two
Note the correct values for each option.Expected behavior
Values for each option of a select field rendered in HTML should be the same as in the field creation code snippet.
Isolating the problem (mark completed items with an [x]):
The text was updated successfully, but these errors were encountered: