> -----Original Message-----
> From: Anil Garg [mailto:[EMAIL PROTECTED]]
> Sent: 11 June 2002 15:01
>
> Hi,
> In a form i have two elements:
>
> I
> <input type="text" name="name" size=25 value="test">
>
> II
> <select name="categories[]" multiple size=10>
> <? option value = ...?>....
> <? option value = ....?>....
>
> Now i want to show an alert message(using javascript) if the
> text field is
> empty or no option is selected from categories list.
>
> For the text field its working fine as below (the javascript
> method called
> when onsubmit method is called):
>
> if(theForm.name.value==""){
> alert("You must enter a Title.");
> theForm.name.focus();
> return(false);
> }
>
> But for the options list(categories) i have tried my best
> but i couldnt get
> it work.
if (theForm["categories[]"].value==""){
... no category selected ...
}
This is standard JavaScript: x["y"] is by definition equivalent to x.y
Cheers!
Mike
---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS, LS6 3QS, United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php