users@javaserverfaces-spec-public.java.net

[jsr372-experts mirror] [jsr372-experts] Re: [JAVASERVERFACES_SPEC_PUBLIC-329] DISCUSSION - Add new single HTML radio button component that isn't bound to a list

From: Bauke Scholtz <balusc_at_gmail.com>
Date: Thu, 27 Aug 2015 11:36:36 +0200

To the point, we need to have a renderer (or perhaps a new component) which
makes the below cases possible:

1:
<h:dataTable value="#{bean.items}" var="item">
    <h:column>
        <h:selectOneRadio group="foo" value="#{bean.selectedItem}"
itemValue="#{item}" />
    </h:column>
</h:dataTable>

2:
<ui:repeat value="#{bean.items}" var="item">
    <h:outputLabel for="radioId" value="#{item.label}" />
    <h:selectOneRadio group="foo" value="#{bean.selectedItemValue}"
itemValue="#{item.value}" />
    <br/>
</ui:repeat>

3:
<h:selectOneRadio group="foo" value="#{bean.selectedItem}" itemValue="foo"
/>
<h:selectOneRadio group="foo" value="#{bean.selectedItem}" itemValue="bar"
/>
<h:selectOneRadio group="foo" value="#{bean.selectedItem}" itemValue="baz"
/>

The "group" and "itemValue" attributes are new. All it renders is solely an
<input type="radio"> (no table, no list, no label).

The "group" must be relative to the naming container parent and represent
the common HTML name. Instead of "group" we could perhaps also use a "for"
which then refers a common parent component, e.g. for="tableId",
for="repeatId", for="formId", etc. Only the latter case becomes somewhat
restrictive.

The "itemValue" speaks for itself. The label is just to be provided by
<h:outputLabel> the usual way.

Cheers, B

On Tue, Aug 25, 2015 at 12:18 PM, arjan tijms <arjan.tijms_at_gmail.com> wrote:

> On Tue, Aug 25, 2015 at 6:18 AM, Josh Juneau <juneau001_at_gmail.com> wrote:
> >These trivial
> > issues with JSF have led to many arguments against using the framework.
> The
> > easier it is made for beginners, the better in my opinion.
>
> For beginners especially, but moderately advanced users as well. We've
> seen this time and again with OmniFaces. Trivial functionality that in
> essence encapsulates only a few lines of code using the standard JSF
> API. Yet, users greatly appreciate it.
>
>
>
>
> >
> > Josh Juneau
> > juneau001_at_gmail.com
> > http://jj-blogger.blogspot.com
> > https://www.apress.com/index.php/author/author/view/id/1866
> >
> >
> > On Wed, Aug 19, 2015 at 1:08 PM, arjan tijms <arjan.tijms_at_gmail.com>
> wrote:
> >>
> >> I agree with Bauke, this has been asked for a lot of times by users. I
> >> had a bunch of personal messages in response to my JSF 2.3 wish list
> >> asking for exactly this.
> >>
> >> Such a component seems to be "basic" enough to be a good candidate for
> >> inclusion in the JSF standard component set.
> >>
> >> Kind regards,
> >> Arjan Tijms
> >>
> >> On Wed, Aug 19, 2015 at 7:27 PM, Bauke Scholtz <balusc_at_gmail.com>
> wrote:
> >> > I vote against. This is one of most common requirements from the
> >> > community.
> >> > I'd like to see this to end up in standard component set too. A custom
> >> > renderer is not trivial to starters, for sure not if you'd like to use
> >> > it in
> >> > an repeater component like <h:dataTable><h:column><h:selectOneRadio>
> >> > and/or
> >> > if you want to have a separate <h:outputLabel> for each item.
> >> >
> >> > Cheers, B
> >> >
> >> >
> >> >
> >> >
> >> > On Wed, Aug 19, 2015 at 7:16 PM, manfred riem <
> manfred.riem_at_oracle.com>
> >> > wrote:
> >> >>
> >> >> Hi all,
> >> >>
> >> >> I like to close this one as "Won't fix" as well as it is fairly easy
> to
> >> >> register your own renderer.
> >> >>
> >> >> To introduce a new component for it seems overkill.
> >> >>
> >> >> Thoughts?
> >> >>
> >> >> Note I like to close the loop on this one before 8/26.
> >> >>
> >> >> Thanks!
> >> >>
> >> >> Kind regards,
> >> >> Manfred Riem
> >> >>
> >> >>
> >> >
> >
> >
>