oops, sorry that I was missing something when I replied in my last post.
here's my 2 cents:
in JavaScript, parameters are always passed by values, never reference.
that's the reason why this won't work. guess you have to use direct
reference to your select object, say, document.forms[0].grmpeople.....
hope this helps.
Emily
----Original Message Follows----
From: Vyas Vemu <[EMAIL PROTECTED]>
Please rewrite your function as follows:
<SCRIPT Language="Javascript">
function validate(this_form)
{
if (this_form.gmrpeople.selectedIndex < 0)
{
alert("Please select a user");
return false;
}
return true;
}
</SCRIPT>
This should work.
Good luck.
Vyas
-----Original Message-----
From: Sam Rose [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 07, 1999 2:30 AM
To: [EMAIL PROTECTED]
Subject: A bit of the list subject but ----Javascript
Hello, sorry this is off topic.
I was wondering if any one could help me.
I need to make sure that a select box has items highlighted when the
HTML page is submitted. I have tried this but it does not work, could
someone help me out please.
<script language="Javascript">
function validate(this_form) {
// required form values
var User =
this_form.gmrpeople[this_form.gmrpeople.selectedIndex].value;
//gmrpeople is the select box
//begin validation
if (!( User == "")) {
return true;
}
else {
msg = "\nYou need to highlight an option in the
selectbox:\n";
alert(msg);
return false;
}
}
</SCRIPT>
And with the FORM
<FORM onSubmit="return validate(this)" ACTION="/vdb/newlite"
METHOD="post">
If anyone could help I would be most appreciative.
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
_______________________________________________________________
Get Free Email and Do More On The Web. Visit http://www.msn.com
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html