Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with form validation

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
i have a field called in[field5] that i want to check on form submit bit it wont allow me to use
form.in[field5].value

i cant change the field name either... any ideas anyone

below is an example of what i am using

<script language=javascript>
function checkform(form)
{
if (form.in[field5].value == &quot;&quot;) {
alert( &quot;Please enter your email address.&quot; );
return false ;
}
return true ;
}
</script>
<form enctype=&quot;multipart/form-data&quot; action=classified_upd_submit.php METHOD=POST onsubmit=&quot;return checkform(this);&quot;>
music :<input type=text name=&quot;in[field5]&quot; value=&quot;&quot;>
<input type=submit>
</form>
 
Yes, you can refer to it ordinally --

i.e. - If your form has 7 elements, then you can refer to them like:

document.formName.elements[0].value
document.formName.elements[1].value

and so on --

The elements array is 0 based, so your last element would be #6 --

good luck! :)
Paul Prewett
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top