Search code examples
javajsficefaces

Radio buttons in different parts of the page


I need to place radio button controls with ICEFaces in different parts of my page, according to a layout specification I must meet.

SelectOneRadio control allows me to instantiate several radio buttons in the same container, but I need to place just two radio buttons inside certain table cells, and I then need some controls to be activated or not according to which radio button is selected.

With plain HTML, I obviously need to place the two <inputs wherever I need and give them the same name.

How can I achieve the same using ICEFaces so I can enable/disable controls according to the selection of a specific radio option?

Thank you.


Solution

  • I have no utter idea what IceFaces provides, but Tomahawk has a <t:selectOneRadio> control which supports an extra layout attribute with value of spread which allows you to place the individual radio buttons everywhere you want in the markup using <t:radio>.

    E.g.

    <t:selectOneRadio id="foo" value="#{bean.foo}" layout="spread">
        <f:selectItems value="#{bean.foos}" />
    </t:selectOneRadio>
    ...
    <t:radio for="foo" index="0" />
    ...
    <t:radio for="foo" index="1" />
    ...
    <t:radio for="foo" index="2" />
    ...
    

    Update as turns out, IceFaces has cloned this Tomahawk-invented feature since version 1.7. So just substitute t: with ice: in above example and it'll work as good.