Hello
I have created a form where I need to validate a text field, that is not entered empty, that the text entered contains certain characters and that the number of characters entered is limited, for this I would like to display a different error message for each validation, in My little experience I used two validation rules, "empty: error message" and "email: error message", see screenshot,
Https://nimbus.everhelper.me/client/notes/share/967974/yegc2z25eh0mv8uy02sp
But I have no idea how to indicate the error message for other validations, you can give me a list of possible validation rules or how to create them.
thank you very much
I have created a form where I need to validate a text field, that is not entered empty, that the text entered contains certain characters and that the number of characters entered is limited, for this I would like to display a different error message for each validation, in My little experience I used two validation rules, "empty: error message" and "email: error message", see screenshot,
Https://nimbus.everhelper.me/client/notes/share/967974/yegc2z25eh0mv8uy02sp
But I have no idea how to indicate the error message for other validations, you can give me a list of possible validation rules or how to create them.
thank you very much
Hi zetap,
You can use "maxLength" and "minLength" rules or a custom function and define it (this is included in the v6 FAQs)
Best regards,
Max
You can use "maxLength" and "minLength" rules or a custom function and define it (this is included in the v6 FAQs)
Best regards,
Max
Hello
I followed your suggestion and check the FAQ, specifically "Validating fields", and try to validate with javascript, but I can not understand the function
$ .fn.form.settings.rules.customfn = function (value, param) {
Return false;
};
I did different tests and it always shows me the error message, it does not matter if the value entered is correct or not. I did not know in which variable is the value of the field to be validated or in which variable is the value against which I want to do the validation.
I need to validate that the user enters a specific value and if it does not, show a specific error message, could you explain a little better how to perform the validation?
Thank you very much !
I followed your suggestion and check the FAQ, specifically "Validating fields", and try to validate with javascript, but I can not understand the function
$ .fn.form.settings.rules.customfn = function (value, param) {
Return false;
};
I did different tests and it always shows me the error message, it does not matter if the value entered is correct or not. I did not know in which variable is the value of the field to be validated or in which variable is the value against which I want to do the validation.
I need to validate that the user enters a specific value and if it does not, show a specific error message, could you explain a little better how to perform the validation?
Thank you very much !
Hi zetap,
Yes, you need to change the function according to your needs:
Best regards,
Max
Yes, you need to change the function according to your needs:
$ .fn.form.settings.rules.customfn = function (value, param) {
if(value != "my value"){
Return false;
}else{
return true;
}
};
Best regards,
Max
Hi, thanks for your response
What you tell me to do, was one of the tests that I do and unfortunately it does not work, it seems that the function always returns false and displays the error message, even if you enter the same validated value in the condition. Attached screenshots
Javascript code
https://nimbus.everhelper.me/client/notes/share/970210/cbvy6un9nklxm6g7vip7
Validation rules
Https://nimbus.everhelper.me/client/notes/share/970207/bbngrtvx8qva8s07mnq4
What may be happening?
Thank you very much, Raúl
What you tell me to do, was one of the tests that I do and unfortunately it does not work, it seems that the function always returns false and displays the error message, even if you enter the same validated value in the condition. Attached screenshots
Javascript code
https://nimbus.everhelper.me/client/notes/share/970210/cbvy6un9nklxm6g7vip7
Validation rules
Https://nimbus.everhelper.me/client/notes/share/970207/bbngrtvx8qva8s07mnq4
What may be happening?
Thank you very much, Raúl
Hi Raul,
In your code please replace "$" with "jQuery", I think that should get it working!
Best regards,
Max
In your code please replace "$" with "jQuery", I think that should get it working!
Best regards,
Max
Hello,
is thi possible to use this rule to verify if an input is greater than a number?
thanks
is thi possible to use this rule to verify if an input is greater than a number?
thanks
Hello,
Iv'e found that:
and it's working well.
But if I want to use it inside a repeater area with multiplier, it gives me always error.
I'm supposing is waiting for other -N -fields that actually are not there, because if I switch off the multiplier function ( with is working again.
Any suggestion?
Iv'e found that:
jQuery.fn.form.settings.rules.customfn = function(value, param) {
var x = 12;
if (Number(value) < Number(x)) {
return false;
}else{
return true;
}
};
and it's working well.
But if I want to use it inside a repeater area with multiplier, it gives me always error.
I'm supposing is waiting for other -N -fields that actually are not there, because if I switch off the multiplier function ( with is working again.
Any suggestion?
Hi vismay,
Apologies for the late reply!
The function should work well even if the field is inside a repeater, but your fields inside a repeater must have unique names and ids, this requires using {var:repeater_name.key} shortcode in both field name and id.
Best regards
Apologies for the late reply!
The function should work well even if the field is inside a repeater, but your fields inside a repeater must have unique names and ids, this requires using {var:repeater_name.key} shortcode in both field name and id.
Best regards
This topic is locked and no more replies can be posted.