hello there- I got a working form and my current validation (coded not mootools) about empty fields works like a charm but when i try to validate a number oor alphanumeric character, somehow CF just assumes everything is right and submits the form. Here part of the code:
Can we use this type of code in CF???? or only this types works?:
Thanks in advance
function check(form)
{
if(isNaN(form.postcode.value))
{
alert("Error');
return false;
}
return true;
}
Can we use this type of code in CF???? or only this types works?:
if(form.lastName.value == "") {
alert etc etc
Thanks in advance
Hi Michael,
any type of JS should work as long as it works anywhere else, whats the value of form ??
any type of JS should work as long as it works anywhere else, whats the value of form ??
Well this is the thing. the code works elsewhere but will not work under CF. What CF does assumes everything is ok and moves on... hmmm form name = form.
Do u know if someone was able to make the "if(isNaN(form.postcode.value))" work??? Thanks
Do u know if someone was able to make the "if(isNaN(form.postcode.value))" work??? Thanks
Hi,
I need to see the form= line in your js code, Chronoforms adds ChronoContact_ extension before the form name, so if you gave your form the name of "myform" in the form management then at the actual code it will be ChronoContact_myform!
Max
I need to see the form= line in your js code, Chronoforms adds ChronoContact_ extension before the form name, so if you gave your form the name of "myform" in the form management then at the actual code it will be ChronoContact_myform!
Max
Sorry man but i don't get you-- the form name is 'form'...
the first bit of code I posted works but when i have to check for numbers or alphanumeric they dnt work... let me repaste something--
This works like a charm but if you include this code it checks the firstname and then skips the postcode bit and submits the form..
I'm badly stuck- Thanks in advance
the first bit of code I posted works but when i have to check for numbers or alphanumeric they dnt work... let me repaste something--
function checkForm(form)
{
if(form.firstName.value == "") {
alert("Please enter your First Name");
return false;
}
return true;
}
This works like a charm but if you include this code it checks the firstname and then skips the postcode bit and submits the form..
function checkForm(form)
{
if(form.firstName.value == "") {
alert("Please enter your First Name");
return false;
}
if(isNaN(form.postcode.value))
{
alert("Please enter...");
return false;
}
return true;
}
I'm badly stuck- Thanks in advance
Hi,
well, how do you trigger the check function ? onsubmit event ? using the "this" ?
well, how do you trigger the check function ? onsubmit event ? using the "this" ?
hello i'm using this line in the General tab of CF:
onSubmit="return checkForm(this)"
Good, then it should work and I have just worked on a form which uses the same code idea and using isNaN function also, I can test your code if you like ?
This topic is locked and no more replies can be posted.