JS syntax problem

Dear all,I have this JS validations on a button. All i want to do is check a combo field and call other functions in JS header according to that. After validating all i’m calling a button click event…I couldn’t make this run at all…Pls help me…

Thanks in advance

Shana

if (document.forms[0].Fld_Catg.selectedIndex == 0) then

{

a=isEmptymessage(document.forms[0].St_Date.value,“Start Date”)

if (a ==true) {

a=isValidDate(document.forms[0].St_Date.value)

if (a ==true) {

a=isEmptymessage(document.forms[0].End_Date.value,“End Date”)

if (a ==true) {

a=isValidDate(document.forms[0].End_Date.value)

if (a ==true) {

a=dateOrder(document.forms[0].St_Date.value,document.forms[0].End_Date.value)

}}}}

else if (document.forms[0].Fld_Catg.selectedIndex == 1) then

{

a= isEmptyCombo(document.forms[0].Fld_ResPers.value,“Responsible Person”)

}

else if (document.forms[0].Fld_Catg.selectedIndex == 2) then

{

a= isEmptyCombo(document.forms[0].Fld_Division.value,“Responsible Person”)

}

if (a ==true) {

document.forms[0].SearchDB2.click();

}}

Subject: JS syntax problem…

I didn’t really dive into your code (it’s early in the morning here), but what can help debug the javascript is: try Firefox as a browser and install the extension “Firebug” - this tool will show you the exact line where the script goes bad.

Martin Vereecken

http://www.bizzybee.be (Notes blog)

Subject: RE: JS syntax problem…

Hi,

In addition check JavaScript Tutorial

In Javascript condition statment “then” is not required.

if (conditon) (

// if true I do that… or I return what I want

// Example : a message and return true

alert(‘It’s true’)

return true;

} else {

/* If false, I do that… or I return what I want

Example : a message and return false */

alert(‘It’s false’)

return false;

}

HTH

Thierry