I am completely new to Chronoforms so I had a look in the CFv5 FAQ and searched but could not find the answer.
I would like to validate the first character of a field to be "r", perhaps by using the regex ^r.*
How can I do that please? Do I have to put something in "extra params" for the field?
Also can you recommend an introduction, tutorial or manual for CFv5?
Regards
Geoff
I would like to validate the first character of a field to be "r", perhaps by using the regex ^r.*
How can I do that please? Do I have to put something in "extra params" for the field?
Also can you recommend an introduction, tutorial or manual for CFv5?
Regards
Geoff
Hi Geoff,
Under the field validation tab there is a place to enter a validation function name, the function can be defined inside a "Load JS" action, the function takes one parameter which is the element (the field object) and should return true or false!
Regards,
Max
Under the field validation tab there is a place to enter a validation function name, the function can be defined inside a "Load JS" action, the function takes one parameter which is the element (the field object) and should return true or false!
Regards,
Max
Hi Max,
Thanks for that. After a lot of frustration I finally realised that it is necessary to hit the "apply" button before the "test form" button. I wonder if there is a reason for that or just that the "test form" button is newer. Maybe the "test form" button ought to always pick up the latest copy of the form?
I should have mentioned that I am also new to Javascript. I know it is not your job to teach me that but perhaps there is a very obvious error in this:
If not then please ignore that and yes you have answered my main question but I would still like to know if you have any beginners guide to CFv5 in preparation. My first impressions of Chronoforms are that it is pretty powerful and has knowlegable support people but needs a bit more up to date documentation before I would be willing to move to the paid version. Or perhaps the paid version does have more documentation?
Regards
Geoff
Thanks for that. After a lot of frustration I finally realised that it is necessary to hit the "apply" button before the "test form" button. I wonder if there is a reason for that or just that the "test form" button is newer. Maybe the "test form" button ought to always pick up the latest copy of the form?
I should have mentioned that I am also new to Javascript. I know it is not your job to teach me that but perhaps there is a very obvious error in this:
function validateRippleAddress(RipplePublicAddress){
if (RipplePublicAddress.value.charAt(0) != "r"){
alert("Ripple public addresses start with 'r'");
return false;
}
}
return true;
If not then please ignore that and yes you have answered my main question but I would still like to know if you have any beginners guide to CFv5 in preparation. My first impressions of Chronoforms are that it is pretty powerful and has knowlegable support people but needs a bit more up to date documentation before I would be willing to move to the paid version. Or perhaps the paid version does have more documentation?
Regards
Geoff
Hi Geoff,
The correct code should be this way:
Most CFv4 FAQs should still help with v5, we are adding more when necessary!
The test form button will test the last saved version of the form!
Regards,
Max
The correct code should be this way:
function validateRippleAddress(RipplePublicAddress){
if (RipplePublicAddress.value.charAt(0) != "r"){
alert("Ripple public addresses start with 'r'");
return false;
}
return true;
}
Most CFv4 FAQs should still help with v5, we are adding more when necessary!
The test form button will test the last saved version of the form!
Regards,
Max
Hi Max,
I do not get a string from the field object of a text box. Do you have a tip? Thanks in advance.
Regards,
Henning
I do not get a string from the field object of a text box. Do you have a tip? Thanks in advance.
Regards,
Henning
I'm not sure I can understand your question, but the function may be modified to be like this:
The function takes the field object, you may test the value using "console.log(fldobj);", you can view the result in the console debug window!
Regards,
Max
function validateRippleAddress(fldobj){
if (fldobj.val().charAt(0) != "r"){
alert("Ripple public addresses start with 'r'");
return false;
}
return true;
}
The function takes the field object, you may test the value using "console.log(fldobj);", you can view the result in the console debug window!
Regards,
Max
Hi there
I'm not that familiar with JS so please don't blame me, I can't figure out how to pass the text of TextBox "text1" to the function.
In Text Box > Edit > Validation > Custom Function: validateLength
Then I got my function in JS: where text1 is the name of my text box.
text1 is not recognized as the value of its text box. so the return value is always false;
how to pass the right value to the function?
any help really appreciated!
I'm not that familiar with JS so please don't blame me, I can't figure out how to pass the text of TextBox "text1" to the function.
In Text Box > Edit > Validation > Custom Function: validateLength
Then I got my function in JS: where text1 is the name of my text box.
function validateLength(text1){
console.info("validate input: ", text1.value);
if (text1.length != 12){
console.error("length is: ",text1.length);
return false;
}
return true;
}
text1 is not recognized as the value of its text box. so the return value is always false;
how to pass the right value to the function?
any help really appreciated!
Hi mued,
The field object is passed to the function, so in order to get the value length, you should use:
You can also use
Regards,
Max
The field object is passed to the function, so in order to get the value length, you should use:
text1.val().length
You can also use
console.log(text1.val());
Regards,
Max
This topic is locked and no more replies can be posted.