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
Inline form field validation #4322
Conversation
…line-form-validation
This is a very interesting PR, will this be automatic or will we need to add anything to the YAML files? Also will there be any option to add custom regex and/or to create custom tool tips in any of the form fields, to fine tune things from default messages. |
@ayumihamsaki that would be a separate feature. See the discussion in the previous PR for more information on how this works. |
@ayumihamsaki There will be a flag in the YAML file for either the form config or the fields config called It uses the validation and messages that are already defined for normal model validation via the Validation trait. |
|
@bennothommo I have an idea, need your opinion, about how sane it is :) Improvement: To Minor Tab UI improvement: Add icon for tabs where validation failed. |
@w20k Definitely on board with the Tab UI idea. I think the front-end baked validation might be good as a complement to the inline validation, however, I wouldn't trust the validation being done fully on the front-end as that leaves it open to be circumvented (ie. people using the Developer Tools to remove the validation and sending through incorrect data). It still definitely needs to be checked server-side. |
@bennothommo yeah, post validation should be done also on serve, that's no doubt! Thanks, @bennothommo for your input! ;) |
@w20k One of the main reasons I was setting it up to validate completely server side was due to some of the complex validations that can be done through the Validation trait as well as allowing plugins to hook into an event that will be provided. Those things could not really be emulated completely in front-end. |
Shoot me with an example @bennothommo, if you have one in mind. Maybe there is an option to implement it on the front-end 😄 If it's too complex will leave as it is, still an awesome addition! |
@w20k One that immediately springs to mind is a "unique" check, for example for slugs. |
This pull request will be closed and archived in 3 days, as there has been no activity in the last 60 days. |
Not really a shortcoming, quite a common pattern to save on double handling in the code, which is what this code introduces. Users don't really care about immediate feedback and a delay upon submission is seasoned UX |
This PR is a resubmission of #4034 with a core branch.
This is a WIP to implement inline form field validation for forms built with the Form widget.
One of the shortcomings of validation in October currently is that the form is validated on submission, and only one error message is shown via a flash message. While this is fine for smaller forms, when larger forms are produced, and the possibility of multiple fields having issues increases, it could cause frustration getting messages one at a time.
This pull request aims to provide immediate feedback on errors with form field contents by:
At the moment, the scope is to only handle simple form fields, such as text inputs and textareas, select dropdowns, radio options, and checkboxes, but could potentially extend to more advanced widgets if they can be easily validated in the context of a model.
Tasks:
form_config.yaml
to enable/disable validation