How’s it going, I'm a Adam, a Full-Stack Engineer, actively searching for work. I'm all about JavaScript. And Frontend but don't let that fool you - I've also got some serious Backend skills.
Location
City of Bath, UK 🇬🇧
Education
10 plus years* active enterprise development experience and a Fine art degree 🎨
I agree it gives you all the elements so I probably meant to take the time to write elements which hold value but I am on my phone so... None the less such css selector is no more painful to write (if on a keyboard).
For the custom messages, everyone gets the wrong end of the stick when I spout this commonly sited answer. To them I usually say "Add novalidate to your html form element and build a minimal custom validation messaging UI but retain the native validation methods." - it never goes well.
How’s it going, I'm a Adam, a Full-Stack Engineer, actively searching for work. I'm all about JavaScript. And Frontend but don't let that fool you - I've also got some serious Backend skills.
Location
City of Bath, UK 🇬🇧
Education
10 plus years* active enterprise development experience and a Fine art degree 🎨
Exactly, a good starting point. If it where me, I would just add no validate to the form and use the sited API adding messages to a div. I like that you can though, good info.
Ah pretty cool I would indeed opt for custom validation since designers love inline validation or some custom view to it.
Pretty neat however we can use it to set custom validation as well!
Going to spend some time on this and see what I can find out about this validation API and custom errors.
Just looking at the last description he still uses the javascript method to get all the forms elements.
Just trying to say even with the validation API it still seems to have it's use-cases to get all a form's elements?
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hey Adam,
That will give you literally all the elements including divs etc.
In my example, it will only give you form-based elements.
In cases where you need to either detect input change with JS I use this.
Or where you want custom validation (error messages etc)
Don't think the form validation API does any of that
For instance, see this angular example where I need to manually push change event after third-party plugin form film
I agree it gives you all the elements so I probably meant to take the time to write elements which hold
value
but I am on my phone so... None the less such css selector is no more painful to write (if on a keyboard).For the custom messages, everyone gets the wrong end of the stick when I spout this commonly sited answer. To them I usually say "Add
novalidate
to your html form element and build a minimal custom validation messaging UI but retain the native validation methods." - it never goes well.just for reference, the validation API does allow you to set a custom message
developer.mozilla.org/en-US/docs/W...
although, it's quite clunky some times, a better example can be found here
developer.mozilla.org/en-US/docs/W...
Exactly, a good starting point. If it where me, I would just add no validate to the form and use the sited API adding messages to a div. I like that you can though, good info.
Ah pretty cool I would indeed opt for custom validation since designers love inline validation or some custom view to it.
Pretty neat however we can use it to set custom validation as well!
Going to spend some time on this and see what I can find out about this validation API and custom errors.
Just found this explanation:
css-tricks.com/form-validation-par...
Just looking at the last description he still uses the javascript method to get all the forms elements.
Just trying to say even with the validation API it still seems to have it's use-cases to get all a form's elements?