-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
HTML5 validation not respected. #5883
Comments
Related Slack discussion: https://wordpress.slack.com/archives/C02QB2JS7/p1522328142000263 My thoughts: We need to better understand the use cases where one would expect to use validation. I expect it has to do with having required fields for a block before allowing the post to be saved. In which case, we might want to consider taking this consideration out of the markup alone, and making it a property of the attribute itself (a required block attribute). Alternatively, or in addition, in the context of the editor, we should consider when validation should occur; immediately? At the time of save? |
When i discovered it i was simply trying to add a min/max value to a number input, i only checked "required" after the fact just to see it that worked (which it didn't) |
Related #4063 |
I would add a comment regarding the HTML5 validation for custom fields as well. If we create a meta box with a simple text input, which has |
Can we get a status update on this issue? |
I'm going to go ahead and close this as there hasn't been any recent discussion here and there's no decision on the viability of adding this feature. It can always be reopened or a new issue created if anyone wants to explore further. |
Issue Overview
HTML5 Validation is not respected by the block settings, for example "required" or for input type number the max or min values.
Steps to Reproduce (for bugs)
`
{
| label: 'Height:',
| help: 'This is the height of the map, for static maps you can only use px values.',
| value: props.attributes.static_height,
| type: 'number', placeholder: '400', 'max': '2000','min': '100','required': 'required', onChange: function ( static_height ) {
| props.setAttributes({ static_height: static_height } ) }
| }
`
Chrome, on Ubuntu
Expected Behavior
I expect it should respect the html5 validation and not submit or save the values.
I understand these values are updated live and not fully part of the form submission, so maybe our best bet is for "required" give it a red border but for max/min this should be easy enough to implement
Current Behavior
it submits and saves the out of bounds values.
Possible Solution
Screenshots / Video
Related Issues and/or PRs
Todos
The text was updated successfully, but these errors were encountered: