Buy Now
Sign in

Dynamic Validation

WhiteLighter01 , November 04 2016
WhiteLighter01 40
November 04 2016 #362848
Hi all,

In CF3 running on Joomla, I am able to do a dynamic validation using the code below

function makeRequired(el){

function makeOptional(el){
el.setProperty('class', '');

What would be the CF5 on WordPress equivalent to this? I'm aware about the FAQ regarding Custom Validation and it is working great on most of my forms. It is just this one form that I'm currently working on has so many variables that affects which field is required and which field are not required. I can go use the samples on the FAQ but debugging 250 lines of if/else logic would be difficult. So I'm planning to just call the function with the concerned fields to apply the validation as needed.

GreyHead 63.2
November 05 2016 #362855
Hi WhiteLighter01,

I have only a little experience with CFv5 on WordPress; that said, I would suggest that you switch to a different jQuery validation library to do dynamic validation. The ChronoForms library sets up the validations on form load and I have never found a good way to over-ride them after that*. While it may be possible it probably isn't worth the work involved. I have used jQuery Validation successfully before.


* The exception is that disabled inputs aren't validated but I don't think that helps in your case.
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much