Click here to Skip to main content
15,903,175 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I've a struts2 checkboxlist as,
<s:checkboxlist list="{'Mon','Tue','Wed','Thur','Fri','Sat','Sun'}" name="processVO.weeklyCal" id="days" disabled="true"/>

But I'm not getting the id 'days' as I specified. id is showing like processVO.weeklyCal-1 upto processVO.weeklyCal-7, when I checked in page source. So I'm not able to write the jQuery function to enable/disable the checkboxlist using the id 'days'. How can I solve this? Pls help

CRDave1988 7-May-12 5:53am    
can u show ur client side page source of checkbox.


use the getElementById function. in your case:

var days = document.getElementById("days");
Share this answer
By default checkboxlist uses the element name as id for the checkbox and label.
You have to use custom theme, and edit the checkboxlist.ftl file.

you need to make changes at two places:

1: default:
<input type="checkbox" name="${}" value="${itemKeyStr?html}"

change to:
<input type="checkbox" name="${}" value="${itemKeyStr?html}"

(changes to, also for the lable to work correctly,
2: default:
<label for="${}-${itemCount}" class... 

change to:
<label for="${}-${itemCount}" class...

(again, to

Note: i have extended simple theme. if you want to know how to create custom theme, the best way is to download and extract the struts2 core jar.
Goto /templates/simple, copy all files to your project dir: /templates/{theme name}

you can set the project default theme to the new theme, try googling if you need more info...
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900