please could somebody tell me what I am doing wrong…I can’t seem to get it setaction(this.value) function to work with the same onClick event as return checkrequired(this) function
<SCRIPT LANGUAGE=”JavaScript”>
<!– Begin
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,0)==””) {
if (((tempobj.type==”text”)&&
tempobj.value==”)||(tempobj.type.toString().charAt(0)==”s”&&
tempobj.selectedIndex==0)) {
pass=false;
break;
}
}
}
}
if (!pass) {
shortFieldName=tempobj.name.substring(2,60).toUpperCase();
alert(“Please Enter the Required Information for “+shortFieldName+” field.”);
//tempobj.focus();
return false;
}
else
return true;
}
function setaction(strVal){
if (strVal == “Click Here to SAVE FORM”){
document.device.action=”devicedatabaseform.asp”;
alert(“You are about to Save your Information”);
document.device.submit();
}
else if (strVal == “Click Here to SUBMIT FORM”){
document.device.action=”devicedatabaseform.asp”;
alert(“You are about to Submit your Information”);
document.device.submit();
}
else {
alert(“a error occured!”)
}
}
// End –>
</script>
response.write(” <input type=””submit”” name=””Action”” value=””Click Here to SUBMIT FORM”” onclick=””return checkrequired(this.form); parent.passDate(this.form.x_TESTDATE.value); setaction(this.value);””></td>”)