Win a copy of Mastering Corda: Blockchain for Java Developers this week in the Cloud/Virtualization 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 ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
  • salvin francis
  • Frits Walraven
  • Piet Souris

Get the value of the checkox index and disable/enable the textbox

Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have 5 rows and each row has a checkbox and a textbox.. by default i m disabling the textbox.. If i check the checkbox the textbox should be enabled & viceversa... how to do it in javascript....

<html:checkbox name="accounts" property="confidential" indexed="true" onclick="javascript:enableTextBox(this.checked)"/>

<html:text name="accounts" property="justificationComments" style="width:150px;" indexed="true" disabled="true"/>

function enableTextBox(status){
status =!status;


the above snippet works only for the 1st checkbox... Even if i click the second checkbox the first textbox only is enabled/disabled.. I am using logic:iterate tag and display the items.. could anyone help please
Ranch Hand
Posts: 213
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The following shows the two ways you can do this using Struts 2.

It's very similar in Struts 1. Hope this helps.
I don't get it. A whale wearing overalls? How does that even work? It's like a tiny ad wearing overalls.
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic