• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

using javascript to get set value of property name with a '.' in it

 
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
I have a textbox mapped to a formBean property.the html output of my struts JSP for that textbox is :
<input type="text" name="builderDetails.forename">

The '.' in the field name is because builderDetails is a attribute of object type Builder which again has a attribute forename.
Now I need a use the value of that field in a javascript . in the javascript, I refer the value of that field as :

where MyForm is the name of the form (and also name of the FormBean) containing the field.
I get javascript error saying 'forename is null or not an object'. Its the 'builderDetails.forename' name that javascript fails to recognize. For other properties say simple 'forename', the javascript works fine.

My question is , How do I use javascript to access fields having names like 'builderDetails.forename' or others with a '.' in the field name?

Thanx
Tanveer

[ May 04, 2005: Message edited by: Tanveer Rameez ]
[ May 04, 2005: Message edited by: Tanveer Rameez ]
 
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I would try

var myElement = document.getElementById("builderDetails.forename");
myElement.value ......

Regards.
 
Tanveer Rameez
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
many thanx. It worked.
[ May 04, 2005: Message edited by: Tanveer Rameez ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic