File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Javascript and Struts Indexed Text Boxes

 
Matt Schulte
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all, thanks for your help in advance.

I am trying to create a javascript that will change the value of a text box when a radio button is clicked. I have an array of beans containing a user and their status being written to the jsp page through the use of struts iterate. When the admin changes the status of the user by clicking a different radio button, I want the text field (to be hidden at a later date) to change to true so I will know in my action when a status has been changed.

Currently the javascript I have gives no errors, but does not change the value of the textboxes either. I have tried multiple ways of changing the values...all are provided in my code.

javascript:



Jsp/Struts


Any help on how to change that value would be great. thanks.
[ May 17, 2006: Message edited by: Matt S. ]
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
when you do

document.name.value="true";

it is look for a form named name

you need to do

document.formName["theNameOfTheElement"].value = "true";

Eric
 
Matt Schulte
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Eric, it works great now!
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64182
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Matt S.",

There aren't many rules that you need to worry about here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Thanks!
bear
JavaRanch Sheriff
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic