4 ms·
True. But you can hide the default message and replace it with your own. You'll still benefit from the form validation.
by 354896547981565 2y ago
True. But you can hide the default message and replace it with your own. You'll still benefit from the form validation.
- deleted 2y ago[deleted]
- jacobr 2y agoYou can even benefit from the default messages if you want that, grabbing `input.validationMessage` and rendering it as you wish.
- gregoriol 2y agoThere is no real benefit because the validation rules allowed there are often too limited for real use-cases anyway.
- epolanski 2y agoWhat do you mean there's no real benefit? You give the same error messages based on whatever custom validation and control the output.
- fkyoureadthedoc 2y agoI've found it more annoying to mess with the browser validation API and using setCustomValidity/reportValidity etc. than to just use other validation libs. Ideally I'd use whatever library I want and they would call setCustomValidity for me though. Using the related pseudo classes :valid, :invalid, :required, :optional is nice, but until last year you still had to do custom logic there because :user-valid/:user-invalid weren't implemented outside of Firefox. That created additional work and was annoying.
- endemic 2y agoDo you have any examples?
- mock-possum 2y agoReally? In my experience they easily cover the majority of cases - strings versus numbers, min and max length, upper and lower bounds to values, specifying what decimal level you’ll accept, you can even straight up provide a regex in the ‘pattern’ attribute.