Hi
I have gone through few forms and tutorials before writing this post.
In one of my forms, I need to validate a field such that:
a. It should not be empty
b. It should be numbers only
c. It should be exactly 8 digits
I believe a and b can be done using editor but not c. So I wrote a JS to perform all the three. But not getting how and where to place it.
1. Placed onSubmit=" return checkForm(this)" in Form tag attachment field
2. Placed below code in Javascript box under form code tab
I have just placed alerts to know whether function is being called or not. But I am not getting any alerts. The form validation is working even if select No in validation tab.
The form is online at http://www.canadabreadfoodservice.ca/lang/promotion-entry-form/madeincanada.html. Any help please
I have gone through few forms and tutorials before writing this post.
In one of my forms, I need to validate a field such that:
a. It should not be empty
b. It should be numbers only
c. It should be exactly 8 digits
I believe a and b can be done using editor but not c. So I wrote a JS to perform all the three. But not getting how and where to place it.
1. Placed onSubmit=" return checkForm(this)" in Form tag attachment field
2. Placed below code in Javascript box under form code tab
function checkForm(form)
{
alert ("jai");
var elem = document.getElementById('text_13');
alert (elem);
var numericExpression = /^[0-9]+$/;
if(elem.value.length == 0){
alert("Customer Number must be filled out");
elem.focus();
return false;
}
else if(!elem.value.match(numericExpression)){
alert("Customer Number must be numbers only");
elem.focus();
return false;
}
else if (elem.value.length !=8)
{
alert("Customer Number must be eight digits");
elem.focus();
return false;
}
return true;
}
I have just placed alerts to know whether function is being called or not. But I am not getting any alerts. The form validation is working even if select No in validation tab.
The form is online at http://www.canadabreadfoodservice.ca/lang/promotion-entry-form/madeincanada.html. Any help please
Hi kumarangopi ,
I just found this from a long time ago while I was away. Have you solved it?
Which version of ChronoForms are you using? You can find the version from Site Admin | Extensions | Install/Uninstall | Components in Joomla! 1.5 or Site Admin | Extensions | Extension Manager | Manage in Joomla! 1.6.
Bob
I just found this from a long time ago while I was away. Have you solved it?
Which version of ChronoForms are you using? You can find the version from Site Admin | Extensions | Install/Uninstall | Components in Joomla! 1.5 or Site Admin | Extensions | Extension Manager | Manage in Joomla! 1.6.
Bob
This topic is locked and no more replies can be posted.