You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Leos Literak <li...@seznam.cz> on 2007/03/22 12:37:43 UTC

different onchange for each value?

Hi,

I have such construct:

<h:selectOneRadio value="#{doc.passed}" id="review" 
onchange="swap_state('test#{index}', this)">
<f:selectItem itemValue="#{true}" itemLabel="pass" id="passRadio"/>
<f:selectItem itemValue="#{false}" itemLabel="fail" id="failRadio"/>
</h:selectOneRadio>

I need to generate HTML, where each radio button will have different
onchange.

<label><input type="radio" value="pass" name="test_radio1" 
onchange="swap_explanation_state('test1', this)" /> pass</label>
<label><input type="radio" value="fail" name="test_radio1" 
onchange="swap_explanation_state('test1', ! this)" /> fail</label>

But I don't see a way, how to achieve it. The onchange attribute
is available only for selectOneRadio container, not for selectItems.
Can I somehow parameterize onchange for each selectItem?

Thank you for your ideas

Leos


Re: different onchange for each value?

Posted by Mike Kienenberger <mk...@gmail.com>.
I've opened this issue.

http://issues.apache.org/jira/browse/TOMAHAWK-939

You can manually patch your version of tomahawk to handle this
temporarily.   A "real solution" will take a bit more work.   Also, if
you're not using facelets, you'll also have to add in tld and jsp
taghandler changes.

On 3/22/07, Leos Literak <li...@seznam.cz> wrote:
> Hi,
>
> I have such construct:
>
> <h:selectOneRadio value="#{doc.passed}" id="review"
> onchange="swap_state('test#{index}', this)">
> <f:selectItem itemValue="#{true}" itemLabel="pass" id="passRadio"/>
> <f:selectItem itemValue="#{false}" itemLabel="fail" id="failRadio"/>
> </h:selectOneRadio>
>
> I need to generate HTML, where each radio button will have different
> onchange.
>
> <label><input type="radio" value="pass" name="test_radio1"
> onchange="swap_explanation_state('test1', this)" /> pass</label>
> <label><input type="radio" value="fail" name="test_radio1"
> onchange="swap_explanation_state('test1', ! this)" /> fail</label>
>
> But I don't see a way, how to achieve it. The onchange attribute
> is available only for selectOneRadio container, not for selectItems.
> Can I somehow parameterize onchange for each selectItem?
>
> Thank you for your ideas
>
> Leos
>
>