• 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

Javascript createTextNode

 
Ranch Hand
Posts: 1026
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The below code works fine and sets the corresponding bean property (name attribute) in the form bean(struts).







How to achieve the same for createTextNode.

How to set the name property for createTextNode. The commented part doesn't work.

I have a corresponding property in form bean object(Struts). How to set it using Javascript.
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not sure why you would want a name on a textnode since you normally would reference it in the future with the id of the element you acces it with:

http://developer.mozilla.org/en/docs/DOM ocument.createTextNode

Eric
 
Vishnu Prakash
Ranch Hand
Posts: 1026
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Let me explain the scenario. I have a table with 3 columns. I had a button called ADD. Onclick of this button one row has to be added to the table. I am invoking JS function here.

First column should be a text field where user can enter data. Second and third columns should be non-editable plain text. For the second and third column I am using createTextNode.

Then when the data is added to the table I click the Save button in the page which saves everything in the page including the 3 column values which are created using JS. I have a bean class( Struts - getter and setter class) where I save all these values.

The names that I had kept for the bean attributes are same as the name property that I had used in JS function.

The following piece of code sets the setter methods correctly in the form bean



The following piece of code adds a text node, but I want to set the value user to the form bean.

createTextNode doesn't support name property which is applicable for the above code.



What should I do to get the data(user) thats there in the JS to set in formbean.





[ July 16, 2007: Message edited by: Vishnu Prakash ]
 
Vishnu Prakash
Ranch Hand
Posts: 1026
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Someone kindly help me with this problem.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Text nodes do not send any values to the server when a form is submitted.
If you want the values to be sent, you'll need to use input fields.
Set the readonly property if you don't want the user to be able to change what's in them.
 
Vishnu Prakash
Ranch Hand
Posts: 1026
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Ben.

I fixed it. Here is the code

 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic