-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Fix validation issues #1245
Fix validation issues #1245
Conversation
Hold for now. Just found a bug when creating a new Contact... the above works for 'edit' but not for 'new' |
This is now ready for actual merge again. Assuming branch checks pass. |
with .. remove html5 'in browser' validation from custom fields to enable Rails validations to provide a better experience (form doesn't submit when section containing invalid custom field is collapsed and therefore not in view) In general I really like to keep these behaviours. Better mobile UX, ability to use patterns, titles, etc. The problem with collapsed/display none elements that are required is usually fixed by one of:
It's more work, but you get the best of both worlds then - instant UX feedback for the basics, and higher level domain errors from rails after submit. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, I wrote all that but don't actually see where you suppressed HTML5 behaviours, so lgtm
Yes, that all makes sense. My js isn't so strong but I'll give it a go. We'd need to expand sections that have invalid fields. I could potentially add html5 'required' attribute to the core fields that require validation too if you like e.g. account name, or contact first_name / last_name (dependent on settings). Will update this PR in a bit. p.s. the html5 validation was removed in app/models/fields/field.rb where 'required' was taken out of input_options which is fed to simple form in the view templates. |
…submitting a form, show invalid fields that are in hidden sections in order to facilitate corrections.
I've updated the code now to re-enable html5 validations for custom fields and also to extend it to core fields also. If a custom field is hidden and invalid, some form submit JS will now open the section that contains the invalid field in order to display the validation message. Bonus: removed '*' required asterisk from a few fields in task that had no underlying validation requirements. I believe this is ready to merge now. |
Ok for me to merge? |
Sorry distracted by shiny things, let me look |
That's really nice. Thank you for going the extra mile |
👍 |
The following features have been implemented: