Hi
I’m new to javascript and have managed to pick up bits and pieces of information off the forum. I have the following code in my jsheader:
function checkForm() {
//if the Reference no field is blank
if (document.forms[0].IC_RefNo.value == “”) {
alert(“Please enter the Complaint Reference Number.”);
document.forms[0].IC_RefNo.focus();
return false;
}
//if the Complaint Received date is blank
if (document.forms[0].IC_DateRec.value == “”) {
alert(“Please enter the Complaint Received Date.”);
document.forms[0].IC_DateRec.focus();
return false;
}
//if the Product Group field is blank
if (document.forms[0].IC_ProdGroup.value == “”) {
alert(“Please select the Product Group address.”);
document.forms[0].IC_ProdGroup.focus();
return false;
}
//if the Product field is blank
if (document.forms[0].IC_Prod.value == “”) {
alert(“Please select the relevant product.”);
document.forms[0].IC_Prod.focus();
return false;
}
//if the Fault is blank
if (document.forms[0].IC_Fault.value == “”) {
alert(“Please select the relevant Fault.”);
document.forms[0].IC_Fault.focus();
return false;
}
//if the Batch Number is blank
if (document.forms[0].IC_BatchNo.value == “”) {
alert(“Please enter the appropriate Batch Number.”);
document.forms[0].IC_BatchNo.focus();
return false;
}
//if the Shade Number is blank
if (document.forms[0].IC_ShadeNo.value == “”) {
alert(“Please enter the relevant Shade Number.”);
document.forms[0].IC_ShadeNo.focus();
return false;
}
//if the Area Meterage is blank
if (document.forms[0].IC_Area.value == “”) {
alert(“Please enter the Area Meterage.”);
document.forms[0].IC_RefNo.focus();
return false;
}
//all is well, so submit the document
document.forms[0].submit()
}
and I’ve put the following code into a submit button on the form:
return checkForm()
but when I load the form in Internet Explorer the button does not appear. I’ve tried putting the code in a save and submit action button but that disappears and if I just user @command ([FileSave]) in the action button it just ignores the validation. Any help would be greatly appreciated. I figure its something basic but its beyond me now.
Thanks in Advance
Adam