Closed luizbills closed 5 years ago
You mean that the HTML would be parsed and backend (PHP) field validation would be built upon those HTML rules? Are there some rules which are not covered by the browser validation API (https://caniuse.com/#feat=form-validation)?
Are there some rules which are not covered by the browser validation API?
Maybe, idk. But we can use the native html validation rules to create a basic backend validator. Other rules can be implemented using a special field attribute (something like data-wplf-validate="..."
).
This seems stale, and IMO advanced validation is not in the scope of this project. Users can add their custom validators.
If anyone implements something like this, implement it as a standalone plugin, and I'll gladly feature it on the plugins page. I'm not willing to implement it myself, DOM operations & PHP make me want to go KMS.
We can use some lib like https://github.com/Rct567/DomQuery to parse the HTML and create some validation rules.
e.g:
<input type="email" maxlength="20" required>
this field is required (already implemented) and must be an valid email with 20 chars or less.