Please bear with me on this as I have no idea regarding javascript.
I created a form which is working fine, but I need some fields to be validated. Below is the code I have - I paste the code in the validation area - tested the form but the validation is not working. Can someone please look at the code and tell me how to get it working. Thanks in advance.
I created a form which is working fine, but I need some fields to be validated. Below is the code I have - I paste the code in the validation area - tested the form but the validation is not working. Can someone please look at the code and tell me how to get it working. Thanks in advance.
function validate_email(field,alerttxt)
{
with (field)
{
apos=value.indexOf("@")
dotpos=value.lastIndexOf(".")
if (apos<1||dotpos-apos<2)
{alert(alerttxt);return false}
}
}
function checkForm(KSP)
{
/* CONTACT */
if(KSP.Contact_Name.value == "") {
alert("Please enter a contact name!");
return false;
}
/* COMPANY */
if(KSP.Company_Name.value == "") {
alert("Please enter your school or company name!");
return false;
}
/* MAIL */
with (KSP)
{
if (validate_Email(email,"Please enter an email address!")==false)
{email.focus();return false}
}
/* TELEPHONE */
if(KSP.Phone.value == "") {
alert("Please enter your telephone number!");
return false;
}
/* Ovo se izvršava nakon svih provjera! */
return true;
}
Hi,
The form name is not KSP, open your form page source and see the form name, it should be : ChronoContact_KSP if you have it named as KSP in Chronoforms admin area
Cheers
Max
The form name is not KSP, open your form page source and see the form name, it should be : ChronoContact_KSP if you have it named as KSP in Chronoforms admin area
Cheers
Max
Hi LikeStuff,
You can do most of this with the built in validation in ChronoForms. The messages won't be quite so friendly but otherwise you'll get the same functionality (better for the email) for less effort.
Bob
You can do most of this with the built in validation in ChronoForms. The messages won't be quite so friendly but otherwise you'll get the same functionality (better for the email) for less effort.
Bob
This topic is locked and no more replies can be posted.