• 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

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

 
Greenhorn
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;
document.forms[0].justificationComments.disabled=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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic