Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot set 0 (zero) as the default value for a number field #226

Open
3 tasks done
ipokkel opened this issue Dec 15, 2021 · 0 comments
Open
3 tasks done

Cannot set 0 (zero) as the default value for a number field #226

ipokkel opened this issue Dec 15, 2021 · 0 comments

Comments

@ipokkel
Copy link
Member

ipokkel commented Dec 15, 2021

Describe the bug
When setting the value option to 0 (zero) for a number field so the default number displayed for the field is 0 the field instead displays no value.

To Reproduce
Steps to reproduce the behavior:

  1. Create a code snippet for the site that creates a number field and set the value option for the field to 0
$fields[] = new PMProRH_Field(
		'test_value_zero', // 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
			'value'           => '0',
			'hint'            => 'Testing 0 (zero) as the default value', // 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_value_zero" name="test_value_zero" value="" size="5" class="input ">

Screenshots
211215-1639557253

Expected behavior
If a value of 0 is set for the number field that the field displays 0 as its starting value.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant