Hi
I've desgined the form that I wish to use on my website but am having problems with the validation. I can get one or the other of the two functions working just not both. I want an error message when the user does'nt fill in the fields correctly and a 'thank you for summiting' pop up if the form is filled out correctly.
How can I get both of them to work at wonce?![]()
Script for error message<script>
/*
Check required form elements script-
By JavaScript Kit (http://javascriptkit.com)
Over 200+ free scripts here!
*/
function checkrequired(which){
var pass=true
if (document.images){
for (i=0;i<which.length;i++){
var tempobj=which.elements[i]
if (tempobj.name.substring(0,8)=="required"){
if (((tempobj.type=="text"||tempobj.type=="textarea")&&tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&tempobj.selectedIndex==-1)){
pass=false
break
}
}
}
}
if (!pass){
alert("Error Message here")
return false
}
else
return true
}
</script>
Script for pop-up.<script type="text/javascript">
function createTarget(t){
window.open("comfirm", t, "width=300,height=200");
return true;
}
</script>
Thanks in advance



Reply With Quote
Problem solved!! I'd forgotten the && between events!!

Bookmarks