Rails client-side validation - disable sending until validation passes

The title is self-explanatory. I use client-side validation in rails and it works wonderfully. However, I do not want the submit button on my form to be enabled until all the checks have passed.

Any help would be appreciated.

+4
source share
2 answers

There are callback functions:

ClientSideValidations.callbacks.form.pass(form, eventData) ClientSideValidations.callbacks.form.fail(form, eventData) 

You can disable the submit button by default and fail . and enable it on pass .

+1
source

In case someone later comes looking for an answer to this question, Alexey answers quite correctly. Callbacks are currently available for items that you could use.

https://github.com/DavyJonesLocker/client_side_validations#callbacks

0
source

Source: https://habr.com/ru/post/1490998/


All Articles