Common javascript code

I am using below javascript code on action button “common javascript” event. It give me error on notes client.if (document.forms[0].Date.selectedIndex==0)

{

	alert ("Required: You must enter Date.");

	document.forms[0].Date.focus();

	return false;

}

I want to use this code to validate both on notes client and web client.

please advise.

amp

Subject: Common javascript code.

If your Date field is of type text or date validate usingif(document.forms[0].Date.value == “”)

if it is a list that converts to a select box on the web use

if(document.forms[0].Date.options.selectedIndex == -1)

-1 is returned if nothing is selected. 0 will be returned if the first option is selected.

Subject: RE: Common javascript code.

It works fine but why does it open another window with login screen and close the form on Web client.

I have another issues. I have Tabs for each sections. Each Tab has field needs to be validate. My code generates Javascript error when it come to this field.

document.forms[0].$MyTable.value=“Studesign”;

window.open(“http://test01…local/amp/TestDB.nsf/783b85f0074c067c852570510054ce26/” + document.forms[0].DocID.value+“?OpenDocument”)

//Study Design Tab

if (document.forms[0].Phase.selectedIndex==-1)

{

	alert ("Required: You must select Study Phase. Click on Study Design tab. to got Study Phase.");

	document.forms[0].Phase.focus();

	}