pmpro-register-helper icon indicating copy to clipboard operation
pmpro-register-helper copied to clipboard

Cannot set custom HTML attributes for the min and step attributes

Open ipokkel opened this issue 3 years ago • 0 comments

Describe the bug When setting html_attributes options for min and step these attribute values are not set for the element as per field creation code.

To Reproduce Steps to reproduce the behavior:

  1. Create a code snippet for the site that creates a number field and add min and step to the html_attributes option.
$fields[] = new PMProRH_Field(
	'test_number_min_step', // input field name, used as meta key
	'number',         // field type
	array(
		'label'           => 'Number Test', // display custom label, if not used field name will be used
		'html_attributes' => array(
			'min'  => '5',
			'step' => '5',
		), // add valid html input field attributes
		'hint'            => 'This is a test of html attributes for a number field', // display a hint under field
		'profile'         => true, // show on profile
	)
);
  1. Navigate to the Membership Checkout page on the frontend.
  2. Inspect rendered HTML for the number field.
  3. See error
<input type="number" min="0" step="1" pattern="\d+" id="test_number_min_step" name="test_number_min_step" value="" size="5" class="input ">

Expected behavior That HTML attributes created for a field to be set in the rendered HTML for the element

Isolating the problem (mark completed items with an [x]):

  • [x] I have deactivated other plugins and confirmed this bug occurs when only Paid Memberships Pro plugin is active.
  • [x] This bug happens with a default WordPress theme active, or Memberlite.
  • [x] I can reproduce this bug consistently using the steps above.

ipokkel avatar Dec 15 '21 09:12 ipokkel