Not clear to me how to use js (or jquery) validation with CFv6 - any hints or examples, please?
Hi dzseti,
There is a "Validations rules" box in each field, just write there the rules you want, for example:
Best regards,
Max
There is a "Validations rules" box in each field, just write there the rules you want, for example:
required:this field is required
email:please provide a valid email
Best regards,
Max
First of all, you will need to drag a JavaScript element to your section and include a custom function like the one below:
This function here checks if the field is not empty, its name is "custom", then use "custom:message" in the validations rules box.
Best regards,
Max
jQuery.fn.form.settings.rules.custom = function(value){
if(value){
return true;
}else{
return false;
}
};
This function here checks if the field is not empty, its name is "custom", then use "custom:message" in the validations rules box.
Best regards,
Max
Thanks, Max. Oddly I was trying something like this, but using 'amount:message' instead of 'custom' and it threw a js error. But now I am using 'postcode:message' and '.rules.postcode' (instead of your 'custom:message' and '.rules.custom') and everything is working fine.
Just another observation for you: when using 2 validators of which one is 'required', the red star only appears against the field when 'required' is the first of the 2
Just another observation for you: when using 2 validators of which one is 'required', the red star only appears against the field when 'required' is the first of the 2
Thank you, I will check this.
Additionally, you can use this in the "Extra attributes" box:
To mask the text box value to 5 numeric digits only if this matches your post code validation.
Best regards,
Max
Additionally, you can use this in the "Extra attributes" box:
data-inputmask:'mask' : '99999'
To mask the text box value to 5 numeric digits only if this matches your post code validation.
Best regards,
Max
This topic is locked and no more replies can be posted.