Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Setting check box as readonly in JSP?

 
Ajay Xavier
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.
 
Merrill Higginson
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)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic