wood burning stoves*
The moose likes Struts and the fly likes Setting check box as readonly in JSP? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Setting check box as readonly in JSP?" Watch "Setting check box as readonly in JSP?" New topic
Author

Setting check box as readonly in JSP?

Ajay Xavier
Ranch Hand

Joined: Jan 03, 2005
Posts: 109
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

Joined: Feb 15, 2005
Posts: 4864
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)


Merrill
Consultant, Sima Solutions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Setting check box as readonly in JSP?
 
Similar Threads
Nested hashmap tags for dynamic pulldowns
JSP Struts/JSTL Form problem
problem with EL inside c:if test attribute="${x}"
Pagination in jsp
forEach and hasNext()