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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Referencing fields with . in the field name

Status
Not open for further replies.

mjk

Programmer
Jan 11, 2001
3
US
I am trying to write some functions for an application where the fields are dynamically created, unfortunately, the field names have periods encoding with-in them. When I try to reference these fields I get invalid property errors. I have used the field names look like 'ffdi.sp.emp.desc' so when I try to dereference the value for the field it looks like frm.ffdi.sp.emp.desc.value, which is obviously a problem! The programs to generate the pages are quit extensive, and there are already various form handlers coded, so changing the naming convention would be quite time consuming. ANY HELP??
 
you will have to reference the fields another way. Two alternatives are

using the this keyword:

<input id=&quot;myfield.myfield1.dot.some&quot; onblur=&quot;validate(this)&quot;

or the form.elements array:

form.elements[&quot;fieldname.myfield&quot;].value or
form.elements[numerical_index].value
jared@aauser.com
 
Thanks a bunch, I was not aware that form.elements[&quot;field.name&quot;].value acted differently from form.fieldname.value, but I suppose to quote delimiters help. Thanks a lot!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top