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.
|