Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript 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
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Setting check box as readonly in JSP?

 
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Consider the following code,


when "${selec.comp.isBoolean}" is true i need to display this check box as readonly and avoid user to edit these fields?
Also I need to the store the values of these check boxes(with ${selec.comp.isBoolean} value true) in a java script array. how to store these values?

Regards,
Ajay.
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The "readonly" attribute can only be used for <input> tags of type "text" and "password". It won't work for a checkbox. You can disable the checkbox, but that also means that its value will not be submitted with the form. You can get around this by creating a corresponding hidden field for reach disabled checkbox. That way the values will still be submitted with the form.

As for your JavaScript array, use the same code I gave you in your preivious thread, except look for disabled boxes, rather than unchecked boxes:

if (box.type == "CHECKBOX" && box.disabled)
    Bookmark Topic Watch Topic
  • New Topic