Adam Grinch
August 23rd, 2004, 03:55 PM
Hi everybody, I am still working on a form that suppose to validate it self and proceed only if all that text fields are filled with the correct words. here (http://dsbc.edu/distance/biblical_intro/biblical_intro_1A.htm) is what I am working on. I ve got two scripts that kirupa forum members gave me, but I don't know how to connect them to a form and make everything work
here are java scripts:
function FormSubmit(){
f = self.textbox.value;
if (f == "whatever")
{ alert("Pass") }
else
{ alert("Fail"); }
}
and then in the form action you declare
form action="javascript: FormSubmit()"
and another array:
corrects = ["hello","yes",etc];
//and check all the text fields with one function:
function validate(){
for(i=0;i <corrects.length;++i){
if(corrects[i]!=document.yourForm.elements[i].value){ return (false);
break;}
return (true);
document.yourForm.submit();}}
Can anyone help?!!
here are java scripts:
function FormSubmit(){
f = self.textbox.value;
if (f == "whatever")
{ alert("Pass") }
else
{ alert("Fail"); }
}
and then in the form action you declare
form action="javascript: FormSubmit()"
and another array:
corrects = ["hello","yes",etc];
//and check all the text fields with one function:
function validate(){
for(i=0;i <corrects.length;++i){
if(corrects[i]!=document.yourForm.elements[i].value){ return (false);
break;}
return (true);
document.yourForm.submit();}}
Can anyone help?!!