Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Javascript] Form validation
- From: java.script at seacrets.com (Cutter (JavaScript List))
- Subject: [Javascript] Form validation
- Date: Tue Jan 20 08:13:08 2004
I am writing a form validation script whereby: 1) I create an array of field names 2) I pass this array and the form (this.form) to the valCheck function 3) I loop through each item in the array and evaluate the field to determine if it is a select or not 4) I check to see if a value has been entered/selected 5) If no value then I alert the user they must enter a value before they continue What I want to do next is where it goes awry. I want to focus() on the field that still needs information. I have tried this in a number of ways. form.array[i].focus(); form.sName.focus(); // sName is a string equivelant of the array item I have even tried passing the form name instead of the form object. formName.array[i].focus(); form[formName].array[i].focus(); formName.sName.focus(); form[formName].sName.focus(); What am I doing wrong here? Cutter
- Follow-Ups:
- [Javascript] Form validation
- From: Chris Tifer
- [Javascript] Form validation
- Prev by Date: [Javascript] Function declaration
- Next by Date: [Javascript] Form validation
- Previous by thread: [Javascript] Function declaration
- Next by thread: [Javascript] Form validation
- Index(es):