javascript not working with php
| From: | Anil Garg | Date: | Tue, 11 Jun 2002 14:01:12 +0000 |
| Subject: | javascript not working with php | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-85137@lists.php.net to get a copy of this message | ||
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.
Can anyone please tell me how i can do it.
Thanks
anil