Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Netscape 4.79 isEmpty validation of a pop-up menu always returning tru

Status
Not open for further replies.

cinolas

IS-IT--Management
Jan 2, 2002
31
CA
I use JS to validate a form. Everything works just fine in IE or even Netscape 6.2. The problem occurs with Netscape 4.79 and with a pop-up menu only:

There is a pop-up menu where users are asked to select a gender (don't mind the [FMP] tags, they are used to populate the menu):

<select name=&quot;Sex&quot; value=&quot;&quot;>
<option value=&quot;&quot;>-Select One-
[FMP-valuelist:Sex,list=Sex]
<option value=&quot;[FMP-valuelistitem]&quot;>[FMP-valuelistitem]
[/FMP-valuelist]
</select>

I use the following JS to verify that the field is not empty:

if (isEmpty(document.theForm.Sex.value))
return WarnEmpty(document.theForm.Sex, &quot;Sex&quot;);

function isEmpty (s)
{
var re = /\S/;
return ((s==null) || (s.length==0) || (re.test(s) == 0))
}

For some reason, no matter what I do, this function returns true (the field is empty) (in Netscape 4.79 only).

Any Idea on why ?
but more importantly:
How to make Netscape 4.79 validate the field properly ?

Thanks
 
it returns null (or not an object)

it have to be

document.theForm.Sex[document.theForm.Sex.selectedIndex].value

or

var _fobj=document.theForm.Sex
_fobj[_fobj.selectedIndex].value Victor
 
BRAVO !

It totally does the trick !

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top