JavaScript Validation Problem

Hi

I have the following code to validate the fields on my form:

JS Header Event (Web)

function validate() {

errMSG = “”

if (document.forms[0].IC_RefNo.value == ‘’){

errMSG += “Please Enter a Reference Number \n”;

}

if (document.forms[0].IC_DateRec.value == ‘’){

errMSG += “Please Enter the date received \n”;

}

if (document.forms[0].IC_ProdGroup.value == ‘’){

errMSG += “Please Select the Product Group \n”;

}

if (document.forms[0].IC_Prod.value == ‘’){

errMSG += “Please Select the Product \n”;

}

if (document.forms[0].IC_Fault.value == ‘’){

errMSG += “Please Select the Fault\n”;

}

if (errMSG != “”) {

alert(errMSG);

return false

}

}

OnSubmit Event (Web)

return validate()

This works fine except that IC_ProdGroup is a dialog box, when I select the relevant keyword I am then prompted with the box saying that the fields need to be completed. This the prevents IC_Prod from returning any values as it is a dblookup that returns the relevant values based on what was selected in IC_ProdGroup.

Is there anyway I can prevent the validation from happening until the form is submitted rather than on when keywords change.

Thanks in Advance

Adam

Subject: JavaScript Validation Problem

why don’t you put your validation code on submit button instead of onSubmit Event.

Subject: RE: JavaScript Validation Problem

Hi Sukhvinder

Thank you for your response but I’m not sure how to. I’m new to javascript so I’ve just been pulling bit from the forum and if I put return validate() in a button the button does not appear on the web. Could you help me with what I’m doing wrong.

Thanks

Adam

Subject: RE: JavaScript Validation Problem

check if button is pass thru HTML or not.Bcoz button which arepass thru HTML doesn’t view on web.