javaserverfaces-spec-public
  1. javaserverfaces-spec-public
  2. JAVASERVERFACES_SPEC_PUBLIC-329

Add new single HTML radio button component that isn't bound to a list

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Critical Critical
    • Resolution: Unresolved
    • Affects Version/s: 2.0
    • Fix Version/s: None
    • Component/s: Components/Renderers
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      329
    • Status Whiteboard:
      Hide

      cat2 renderkitdoc size_medium importance_small

      Show
      cat2 renderkitdoc size_medium importance_small

      Description

      The selectOneRadio component requires that all radio buttons be grouped
      together. This is very inflexible when creating user interfaces. Many times I
      have encountered screens where I need multiple radio buttons in the same group,
      but each radio button exists in a separate area of the screen. This can be done
      in HTML easily, but not with JSF's default component set.

      I've read that Apache MyFaces has created a component to solve this issue, and
      so has Sun's Woodstock component set. Please standardize this fundamental
      component in JSF 2.0 so that all implementations come with it.

        Activity

        Hide
        Manfred Riem added a comment -

        Setting priority to Critical

        Show
        Manfred Riem added a comment - Setting priority to Critical
        Hide
        Ed Burns added a comment -

        Set priority to baseline ahead of JSF 2.3 triage. Priorities will be assigned accurately after this exercise.

        Show
        Ed Burns added a comment - Set priority to baseline ahead of JSF 2.3 triage. Priorities will be assigned accurately after this exercise.
        Hide
        rdelaplante added a comment -

        I was working with the t:radio component from Trinidad recently and discovered an inflexibility. It always renders a label with the radio button and so I had difficulty implementing the layout and wrapping dictated by a web designer. Also, they wanted part of the label text to have different font styling. I was unable to embed any kind of HTML tags in the label text loaded from the backing bean (such as a span or div) because it always escapes the label text.

        If you implement this feature in JSF 2.3 (please do!), it would be nice to have the option to output just the radio button without the label, and also the option to not escape the text in the label.

        Show
        rdelaplante added a comment - I was working with the t:radio component from Trinidad recently and discovered an inflexibility. It always renders a label with the radio button and so I had difficulty implementing the layout and wrapping dictated by a web designer. Also, they wanted part of the label text to have different font styling. I was unable to embed any kind of HTML tags in the label text loaded from the backing bean (such as a span or div) because it always escapes the label text. If you implement this feature in JSF 2.3 (please do!), it would be nice to have the option to output just the radio button without the label, and also the option to not escape the text in the label.
        Hide
        rdelaplante added a comment -

        Please PLEASE get this done in JSF 2.3, we've been waiting way too long for this. With a perfect solution in Trinidad that works well with the existing h:selectOneRadio design, I don' understand why this keeps getting left undone release after release. Search Google for people using JSF and radio buttons and you'll find a lot of misery.

        Show
        rdelaplante added a comment - Please PLEASE get this done in JSF 2.3, we've been waiting way too long for this. With a perfect solution in Trinidad that works well with the existing h:selectOneRadio design, I don' understand why this keeps getting left undone release after release. Search Google for people using JSF and radio buttons and you'll find a lot of misery.
        Hide
        rdelaplante added a comment -

        I like how the Trinidad and IceFaces radio button works. Essentially what they've done is extend the existing h:selectOneRadio and added a new layout constant value called "spread" which tells it to not render itself. Then they created a new t:radio component that renders a single radio button and its label wherever you place it. The t:radio has a "for" attribute that points back to the main selectOneRadio, and an "index" attribute that tells it which of the select items to output. It works with JSF's built-in AJAX and I love it. My only issue is that I can't use it in a ui:repeat loop, but I suspect that is a JSF spec issue related to findComponent. I'd also like to be able to choose if the label is rendered to the left or right of the radio button, or not render the label at all.

        <t:selectOneRadio id="upgradesRadio" layout="spread" value="#

        {model.upgradeSelection}

        ">
        <f:selectItems value="#

        {model.availableUpgrades}

        " var="upgrade" itemLabel="#

        {upgrade.description}

        "/>
        <f:ajax/>
        </t:selectOneRadio>

        ... custom HTML layout ...

        <t:radio for="upgradesRadio" index="0"/>

        ... custom HTML layout ...

        <t:radio for="upgradesRadio" index="1"/>

        Show
        rdelaplante added a comment - I like how the Trinidad and IceFaces radio button works. Essentially what they've done is extend the existing h:selectOneRadio and added a new layout constant value called "spread" which tells it to not render itself. Then they created a new t:radio component that renders a single radio button and its label wherever you place it. The t:radio has a "for" attribute that points back to the main selectOneRadio, and an "index" attribute that tells it which of the select items to output. It works with JSF's built-in AJAX and I love it. My only issue is that I can't use it in a ui:repeat loop, but I suspect that is a JSF spec issue related to findComponent. I'd also like to be able to choose if the label is rendered to the left or right of the radio button, or not render the label at all. <t:selectOneRadio id="upgradesRadio" layout="spread" value="# {model.upgradeSelection} "> <f:selectItems value="# {model.availableUpgrades} " var="upgrade" itemLabel="# {upgrade.description} "/> <f:ajax/> </t:selectOneRadio> ... custom HTML layout ... <t:radio for="upgradesRadio" index="0"/> ... custom HTML layout ... <t:radio for="upgradesRadio" index="1"/>

          People

          • Assignee:
            Unassigned
            Reporter:
            rdelaplante
          • Votes:
            7 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated: