View Single Post
Old May 21st, 2006, 8:44 PM   #1
weeb0
Newbie
 
Join Date: Jan 2006
Posts: 17
Rep Power: 0 weeb0 is on a distinguished road
Unhappy how to get jscript validation with <select name=test[]>

Hi,

I don't have much experience in javascript and I want to validate a form.

here is a sample of the form :

[html]
<form name="frmPoste" action="test.php" onsubmit="return formValidation(this)">
<select name="contact[]" multiple>
<option value="0">add a new contact</option>
</select>
</form>
[/html]

the javascript function I want to use:
[html]
function formValidation(form)
{
if(form.contact.options[0].selected == true)
{
// do validation for some more fields.
}
return true;
}
[/html]

My question is: How can I access the first array to know their value. If he's selected I want to do the validation for more fields.

I know the way I use ( "form.contact.options[0].selected" ) is not valid. I worked to find the correct way about 6 hours and can't find any documentation. So, if you can help me, i would appreciate very much :-)!

Thank you.
weeb0 is offline   Reply With Quote