Validating numeric input

Rated 3.87/5 based on 559 customer reviews

This is because I have to write for both English and French.

If you are using one language only, you might care to find a different lookup method for validation messages. Each of my form elements is designed as a Vue component which can be collected together within larger form elements.

For each form field, I pass in the Vuelidate test object as a component property called 'validation'. I can't get the development environment to run in Windows 10. Also, default auto-gen error messages would be nice, like how Vee Validate has them. Hopefully with contributions we can get it up to par with Laravel's at some point, much like how Vee Validate has tried. This is super crude and work-in-progress but works...

You can use a client-side scripting solution like Java Script that performs certain validation rules before submitting the form data.

When the the input 'blur' DOM event occurs, I fire "$touch()" on the Vuelidate object, so messages only display once the user clicks away, however you might care to do this differently such as touching the validation immediately upon every keystroke. ;-) Generally, the point is "display Title" is whatever the user knows to be the display name for the form field.

You'll see right away a fault condition where "display Title" might be null and yet passed for the 'attribute' message variable as null. @Sir Lamer I like your approach, but now even more as a separate thing.

I simply don't want to favour Laravel above anything else in particular, even if I actually don't have anything against it.

You could actually make a library that focuses on doing exactly that - bringing a set of validators implemented in JS that closely match the ones in Laravel, including the naming convention.

Leave a Reply