Here is one solution:

Write a custom renderer. In that renderer, make a parent component with two temporal child components. First child: select one checkbox. Second child: output link.

On the rendering of the checkbox, record it's client ID in a variable. On rendering of the output link, add a "_javascript_: getElementById('"+checkboxId +"').value = !getElementById('"+checkboxId +"').value;" as the URL of the link. This will toggle the value of the checkbox.

Doing it as a custom component and a renderer you will have access to the client ID of the checkbox. Another alternative is to use forceId and just hand-code the output:

<script>
function toggleCheckbox(elemId)
{
var elem = document.getElementById(elemId)
elem.value = !elem.value
}
</script>
<t:selectBooleanCheckBox id="mycheckbox" forceId="true" .../>
<t:outputLink url="" toggleCheckbox('mycheckbox')" />

There are other solutions and variations, but this should work for you. Depends on how much work you want to do to make it nice. Sounds like a good idea for a sandbox component to me (if only I had the time...)

-Andrew

On 5/3/06, fischman_98 <[EMAIL PROTECTED]> wrote:

Anyone know how to make the itemLabel of a SelectItem a href?

I'd like to produce a checkbox that looks like this:


COLUMBIA RIVER (WASHINGTON)

SUN
CLOUDS


View this message in context: t:selectManyCheckbox - Make Checkbox label a link
Sent from the MyFaces - Users forum at Nabble.com.

Reply via email to