Win a copy of Modern JavaScript for the Impatient this week in the Server-Side JavaScript and NodeJS forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Javascript and Struts Indexed Text Boxes

 
Greenhorn
Posts: 4
  • 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. ]
 
author
Posts: 15385
6
  • 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
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Eric, it works great now!
 
Marshal
Posts: 67445
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • 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
 
Brace yourself while corporate america tries to sell us its things. Some day they will chill and use tiny ads.
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic