faqts : Computers : Programming : Languages : JavaScript : Language Core : Arrays

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

0 of 2 people (0%) answered Yes
Recently 0 of 2 people (0%) answered Yes


How do I validate 3 form fields called field[ ], field[ ] & field[ ] to see if they were filled in?

Feb 2nd, 2005 05:11
jsWalter, John Kelly,

This is a real easy to use validation class for client-side HTML forms. 
It's still a work in progress, but it works great. 
Hop it helps. 
OK, not a good anwser. 
If your form fields all have the same name (which is legal) JS has no 
way of identifing any of them as indviduals. 
What I do is give each a unique ID, "field_1", "field_2", etc. 
With that, then you can access any of this "collection" and validatae 
as you need. 
   objField = document.getElementById ( 'field_2' ); 
Now you can do waht you need. 
Hope that helps. 
PS: jsValidate is still an easy way to do form level validation! ;)