Hi all,
We’ve got custom front end ajax validation that we’ve been using for a front end form for ages, and we’ve discovered on our last update that acf.validation.toggle(); is no longer a js function. I can see that 5.7 had quite a few js changes as mentioned in the blog entry.
Will this functionality be added back in, or is there another approach I should use to lock/unlock the form as it validates?
Thanks!
I’ve solved this using:
acf.validation.disableSubmit($submit);
acf.validation.showSpinner($spinner);
and
acf.validation.enableSubmit($submit);
acf.validation.showSpinner($spinner);
to replicate the functionality I was looking for.
Try this:
acf.validation.lockForm( $form );
acf.validation.unlockForm( $form )
Works for me.
acf.validation.lockForm does not exist, but acf.lockForm does. Not sure if it changed to this, or just a typo, but it’s not working for me in any case for repeat submissions.
I’m on 5.7.6, but reverting back to 5.6.10.
Hi @wilirius
Adding support for deprecated JS functions is something I spent some time solving in ACF v5.7.
In version 5.7.6, technically the acf.validation.lockForm()
no longer exists, however, it is still usable.
The acf.validation object inherits all functions from its “prototype” which you can inspect here acf.validation.__proto__
. This object does contain the lockForm() function so you can continue using acf.validation.lockForm()
without any issues 🙂
I’m trying to use
acf.validation.disableSubmit($submit);
acf.validation.showSpinner($spinner);
And
acf.validation.enableSubmit($submit);
acf.validation.hideSpinner($spinner);
And nothing doing. I can disable the submit and show the spinner but I cannot enable submit and hide the spinner. Where is the documentation on these functions?