Enable Dynamically named checkbox

View: New views
2 Messages — Rating Filter:   Alert me  

Enable Dynamically named checkbox

by Lauren Riley :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have a list of objects that have ID's. I'm creating a checkbox for each, naming the checkbox id+"cb" as I iterator through the list. I am disabling the checkboxes to begin with. At a certain point in time, I want to enable the checkboxes one at a time. Is that possible with DWR? This is what I have now and it is not working. Anybody know how I could do this in DWR or how I could tweak this code to work? Thank you...

function enableCheckbox(){
var id = dwr.util.getValue("selectOutbuilding");
var name = id+'cb';
document.choiceForm.+ name + .disabled = false;
}


<c:forEach items="${outbuildings}" var="building">
<input type="checkbox" name="${building.id}cb" disabled="true">${building.description}</><BR>
</c:forEach>

__________________________________________
The information contained in this message may be privileged and confidential and protected from disclosure. If you are not the intended recipient of this message, you are hereby notified that any dissemination, distribution, or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by replying to the message, and please delete it from your computer.


Parent Message unknown Re: Enable Dynamically named checkbox

by Lance Java :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

You could either give each checkbox an id and dwr.util.byId(i + "cb").disabled = false

Or you can try
document.choiceForm[name].disabled = false

Cheers,
Lance.

2008/5/8 Lauren Riley <Lauren.Riley@...>:

I have a list of objects that have ID's. I'm creating a checkbox for each, naming the checkbox id+"cb" as I iterator through the list. I am disabling the checkboxes to begin with. At a certain point in time, I want to enable the checkboxes one at a time. Is that possible with DWR? This is what I have now and it is not working. Anybody know how I could do this in DWR or how I could tweak this code to work? Thank you...

function enableCheckbox(){
var id = dwr.util.getValue("selectOutbuilding");
var name = id+'cb';
document.choiceForm.+ name + .disabled = false;
}


<c:forEach items="${outbuildings}" var="building">
<input type="checkbox" name="${building.id}cb" disabled="true">${building.description}</><BR>
</c:forEach>

__________________________________________
The information contained in this message may be privileged and confidential and protected from disclosure. If you are not the intended recipient of this message, you are hereby notified that any dissemination, distribution, or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by replying to the message, and please delete it from your computer.