How to access textfields list?
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Rui_Batista
Posted On:   Tuesday, August 5, 2003 04:48 PM

I have a form with N textfields, and I have an onchange event VALIDATE() associated each textfield.
The textfield name is qtd_1,qtd_2,...qtd_N.

The question is:
How can I access the value of select textfield?
There are any method that can search an object by name?

Thanks

Re: How to access textfields list?

Posted By:   Nitesh_Naveen  
Posted On:   Wednesday, August 6, 2003 02:08 AM

I you just need to validate, you can pass the object itself using 'this' as Uday has pointed out. In the function you can use the object directly to validate it.
ie if your funcion lookd like...

function validate(myObj)
{
var enteredVal = myObj.value;
if(enteredVal == "")
alert("Cannot be empty")
...
}

Re: How to access textfields list?

Posted By:   Uday_Kiran  
Posted On:   Tuesday, August 5, 2003 11:37 PM

Pass the parameter validate(this) from each text field. In the validate method, you can use this.name to know which field is that - qtd_1 or qtd_2 etc.
About | Sitemap | Contact