Client Side Validations

Hi, i’ m porting my application from rails to phoenix.

In rails i used this gem for client side validation:

Is there any mix plugin similar to it?


For anything beyond the simple HTML5 form validations I think you’re better off using a client side library (such as Vue or React) to control the form and saving/loading the form data via API requests. This gives your application a clear separation of concerns. You can either duplicate the validations in the client side code (which has the benefit of requiring no request to the server) or use an API request to check the server side validation (avoiding duplication, but requiring a new request each time you want to validate a field).

You can also use something like unpoly.js, it can take your entire form when a field changes, request it to the server (with a special header so you know not to commit the change and just do validation tests), and displays the validation results, it is really nice and you keep the validation server-side for a lot of things that just cannot really be tested client-side as well. But yeah, html5 standard validations are fine most of the time.