You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Paul Spencer <pa...@apache.org> on 2006/06/13 18:57:02 UTC

How can I display radio buttons in 2 columns?

I would like to display a long list of radio buttons in 3 columns?

Paul Spencer


RE: How can I display radio buttons in 2 columns?

Posted by Michael Heinen <mh...@recommind.com>.
Thanks Paul.
Thats bitter ...

-----Original Message-----
From: Paul Spencer [mailto:paulsp@apache.org] 
Sent: Mittwoch, 12. Juli 2006 13:54
To: MyFaces Discussion
Subject: Re: How can I display radio buttons in 2 columns?

Michael,
In the case of selectManyCheckbox, their is an attribute, layoutWidth, 
that will display the do the same thing.

Paul Spencer


Michael Heinen wrote:
> Thanks for the improvement.
> Now it is also working with selectManyCheckbox.
> 
> -----Original Message-----
> From: Paul Spencer [mailto:paulsp@apache.org] 
> Sent: Dienstag, 11. Juli 2006 20:36
> To: MyFaces Discussion
> Subject: Re: How can I display radio buttons in 2 columns?
> 
> Rich,
> I have made changes to the wiki largely based on your suggestions.
> 
> Thank you.
> Paul  Spencer
> 
> Rich Argo wrote:
>> I'm using MyFaces & Tomahawk 1.1.1.  There really isn't an error per
> se...
>> the radio buttons display just fine.  It's just when you submit the
> form, no
>> value is set and if there's a form error, the radio button that was
> selected
>> isn't checked.
>>
>> By making the suggested modifications, it'll save other folks a lot
of
> time
>> in figuring this out.  The wiki isn't quite complete as is I guess.
I
> don't
>> want to sound ungrateful -- as is, it did help me get to a point.
>>
>> Viewing this thread led me to the suggested mods:
>>
>
http://mail-archives.apache.org/mod_mbox/myfaces-users/200603.mbox/%3C44
> 1162B8.9010301@weber-oldenburg.de%3E
>> I hope this makes sense.
> 
> 
> 
> 
> 
> 






Re: How can I display radio buttons in 2 columns?

Posted by Paul Spencer <pa...@apache.org>.
Michael,
In the case of selectManyCheckbox, their is an attribute, layoutWidth, 
that will display the do the same thing.

Paul Spencer


Michael Heinen wrote:
> Thanks for the improvement.
> Now it is also working with selectManyCheckbox.
> 
> -----Original Message-----
> From: Paul Spencer [mailto:paulsp@apache.org] 
> Sent: Dienstag, 11. Juli 2006 20:36
> To: MyFaces Discussion
> Subject: Re: How can I display radio buttons in 2 columns?
> 
> Rich,
> I have made changes to the wiki largely based on your suggestions.
> 
> Thank you.
> Paul  Spencer
> 
> Rich Argo wrote:
>> I'm using MyFaces & Tomahawk 1.1.1.  There really isn't an error per
> se...
>> the radio buttons display just fine.  It's just when you submit the
> form, no
>> value is set and if there's a form error, the radio button that was
> selected
>> isn't checked.
>>
>> By making the suggested modifications, it'll save other folks a lot of
> time
>> in figuring this out.  The wiki isn't quite complete as is I guess.  I
> don't
>> want to sound ungrateful -- as is, it did help me get to a point.
>>
>> Viewing this thread led me to the suggested mods:
>>
> http://mail-archives.apache.org/mod_mbox/myfaces-users/200603.mbox/%3C44
> 1162B8.9010301@weber-oldenburg.de%3E
>> I hope this makes sense.
> 
> 
> 
> 
> 
> 


RE: How can I display radio buttons in 2 columns?

Posted by Michael Heinen <mh...@recommind.com>.
Thanks for the improvement.
Now it is also working with selectManyCheckbox.

-----Original Message-----
From: Paul Spencer [mailto:paulsp@apache.org] 
Sent: Dienstag, 11. Juli 2006 20:36
To: MyFaces Discussion
Subject: Re: How can I display radio buttons in 2 columns?

Rich,
I have made changes to the wiki largely based on your suggestions.

Thank you.
Paul  Spencer

Rich Argo wrote:
> I'm using MyFaces & Tomahawk 1.1.1.  There really isn't an error per
se...
> the radio buttons display just fine.  It's just when you submit the
form, no
> value is set and if there's a form error, the radio button that was
selected
> isn't checked.
> 
> By making the suggested modifications, it'll save other folks a lot of
time
> in figuring this out.  The wiki isn't quite complete as is I guess.  I
don't
> want to sound ungrateful -- as is, it did help me get to a point.
> 
> Viewing this thread led me to the suggested mods:
>
http://mail-archives.apache.org/mod_mbox/myfaces-users/200603.mbox/%3C44
1162B8.9010301@weber-oldenburg.de%3E
> 
> I hope this makes sense.






Re: How can I display radio buttons in 2 columns?

Posted by Paul Spencer <pa...@apache.org>.
Rich,
I have made changes to the wiki largely based on your suggestions.

Thank you.
Paul  Spencer

Rich Argo wrote:
> I'm using MyFaces & Tomahawk 1.1.1.  There really isn't an error per se...
> the radio buttons display just fine.  It's just when you submit the form, no
> value is set and if there's a form error, the radio button that was selected
> isn't checked.
> 
> By making the suggested modifications, it'll save other folks a lot of time
> in figuring this out.  The wiki isn't quite complete as is I guess.  I don't
> want to sound ungrateful -- as is, it did help me get to a point.
> 
> Viewing this thread led me to the suggested mods:
> http://mail-archives.apache.org/mod_mbox/myfaces-users/200603.mbox/%3C441162B8.9010301@weber-oldenburg.de%3E
> 
> I hope this makes sense.


Re: How can I display radio buttons in 2 columns?

Posted by Paul Spencer <pa...@apache.org>.
Rich,
I will update the wiki later today.

Thanks for the feedback, this will only make the documentation better 
and encourage other to get involved.

Paul Spencer




Rich Argo wrote:
> I'm using MyFaces & Tomahawk 1.1.1.  There really isn't an error per se...
> the radio buttons display just fine.  It's just when you submit the form, no
> value is set and if there's a form error, the radio button that was selected
> isn't checked.
> 
> By making the suggested modifications, it'll save other folks a lot of time
> in figuring this out.  The wiki isn't quite complete as is I guess.  I don't
> want to sound ungrateful -- as is, it did help me get to a point.
> 
> Viewing this thread led me to the suggested mods:
> http://mail-archives.apache.org/mod_mbox/myfaces-users/200603.mbox/%3C441162B8.9010301@weber-oldenburg.de%3E
> 
> I hope this makes sense.


Re: How can I display radio buttons in 2 columns?

Posted by Rich Argo <ri...@pearson.com>.
I'm using MyFaces & Tomahawk 1.1.1.  There really isn't an error per se...
the radio buttons display just fine.  It's just when you submit the form, no
value is set and if there's a form error, the radio button that was selected
isn't checked.

By making the suggested modifications, it'll save other folks a lot of time
in figuring this out.  The wiki isn't quite complete as is I guess.  I don't
want to sound ungrateful -- as is, it did help me get to a point.

Viewing this thread led me to the suggested mods:
http://mail-archives.apache.org/mod_mbox/myfaces-users/200603.mbox/%3C441162B8.9010301@weber-oldenburg.de%3E

I hope this makes sense.
-- 
View this message in context: http://www.nabble.com/How-can-I-display-radio-buttons-in-2-columns--tf1781389.html#a5273942
Sent from the MyFaces - Users forum at Nabble.com.


Re: How can I display radio buttons in 2 columns?

Posted by Paul Spencer <pa...@apache.org>.
Rich,
The example is based on stuff I am currently using with Tomahawk 1.1.3.

What is the error you are getting and what is your version of Tomahawk?

Paul Spencer



Rich Argo wrote:
> Hey Paul,
> 
> Would you mind updating the wiki page (Dynamic Example) at
> http://wiki.apache.org/myfaces/Display_Radio_Buttons_In_Columns ?  I would,
> but I don't have access to it.  When going by the current wiki page, the
> radio buttons will display, but nothing gets set when the form is posted.
> 
> To fix this, the t:selectOneRadio tag should not be inside the t:dataTable
> tag, but just underneath the h:form tag.  Also, the "for" attribute of the
> t:radio tags should use an absolute id.  Below is a modified example. 
> There's also an added value attribute in the t:selectOneRadio tag, so
> "public String selectedButton" (plus setters/getters) will also need to be
> added to RadioButtons.java.
> 
> 
> &lt;h:form id="theForm"&gt;
> 
>     &lt;t:selectOneRadio id="buttons" 
>                       value="buttonList.selectedButton"
>                       layout="spread" 
>                       forceId="true" 
>                       forceIdIndex="false"&gt;
>         &lt;f:selectItems value="#{buttonList.selectList}" /&gt;
>     &lt;/t:selectOneRadio&gt;
> 
>     &lt;t:dataTable newspaperColumns="3" 
>                  var="row" 
>                  value="#{buttonList.dataModel}" 
>                  rowIndexVar="index"&gt;
>         &lt;h:column&gt;
>             &lt;t:radio for=":theForm:buttons" index="#{index}" /&gt;
>         &lt;/h:column&gt;
>     &lt;/t:dataTable&gt;
> 
> &lt;/h:form&gt;
> 


Re: How can I display radio buttons in 2 columns?

Posted by Rich Argo <ri...@pearson.com>.
Hey Paul,

Would you mind updating the wiki page (Dynamic Example) at
http://wiki.apache.org/myfaces/Display_Radio_Buttons_In_Columns ?  I would,
but I don't have access to it.  When going by the current wiki page, the
radio buttons will display, but nothing gets set when the form is posted.

To fix this, the t:selectOneRadio tag should not be inside the t:dataTable
tag, but just underneath the h:form tag.  Also, the "for" attribute of the
t:radio tags should use an absolute id.  Below is a modified example. 
There's also an added value attribute in the t:selectOneRadio tag, so
"public String selectedButton" (plus setters/getters) will also need to be
added to RadioButtons.java.


&lt;h:form id="theForm"&gt;

    &lt;t:selectOneRadio id="buttons" 
                      value="buttonList.selectedButton"
                      layout="spread" 
                      forceId="true" 
                      forceIdIndex="false"&gt;
        &lt;f:selectItems value="#{buttonList.selectList}" /&gt;
    &lt;/t:selectOneRadio&gt;

    &lt;t:dataTable newspaperColumns="3" 
                 var="row" 
                 value="#{buttonList.dataModel}" 
                 rowIndexVar="index"&gt;
        &lt;h:column&gt;
            &lt;t:radio for=":theForm:buttons" index="#{index}" /&gt;
        &lt;/h:column&gt;
    &lt;/t:dataTable&gt;

&lt;/h:form&gt;

-- 
View this message in context: http://www.nabble.com/How-can-I-display-radio-buttons-in-2-columns--tf1781389.html#a5272501
Sent from the MyFaces - Users forum at Nabble.com.

RE: How can I display radio buttons in 2 columns? (Solved and Documented

Posted by Michael Heinen <mh...@recommind.com>.
I am facing the same problem with selectManyCheckbox.
The setter setSharedResources is never called.

Any help is appreciated
Michael


-----Original Message-----
From: Matt Stine [mailto:Matt.Stine@STJUDE.ORG] 
Sent: Donnerstag, 6. Juli 2006 18:54
To: users@myfaces.apache.org
Subject: Re: How can I display radio buttons in 2 columns? (Solved and
Documented


Hi, all.  I've been trying to solve a similar problem using Paul's wiki
documentation.  Basically I'm trying to display a set of dynamic
checkboxes
in multiple columns.  Here is a code snippet from my JSP:

<t:dataTable newspaperColumns="2" var="row"
value="#{publicationForm.sharedResourceDataModel}"
                     rowIndexVar="index">
    <t:selectManyCheckbox id="sharedResourceCheckboxes" layout="spread"
                                    
value="#{publicationForm.sharedResources}">
        <f:selectItems value="#{publicationForm.sharedResourceList}"/>
    </t:selectManyCheckbox>
    <h:column>
        <t:checkbox for="sharedResourceCheckboxes" index="#{index}"/>
    </h:column>
</t:dataTable>

Now, here's my problem.  When I arrive at this JSP, the checkboxes are
initialized with the values contained in
#{publicationForm.sharedResources}. 
However, if I modify the selections at all and submit, those changes are
ignored.

Does anyone have any idea what may be going on?  If you need any more
information, please let me know.

Thanks!

Matt Stine
Senior Software Engineer
St. Jude Children's Research Hospital
Memphis, TN
matt.stine@stjude.org


Bruno Aranda wrote:
> 
> Thanks Paul!
> 
> Bruno
> 
> On 6/26/06, Paul Spencer <pa...@apache.org> wrote:
>> Based on post to this thread and some trail & error, I have found a
>> solution and documented it in the wiki.
>>    http://wiki.apache.org/myfaces/Display_Radio_Buttons_In_Columns
>>
>> Paul Spencer
>>
>>
>> Paul Spencer wrote:
>> > I thought about using a <t:dataTable> inside <h:selectOneRadio>,
see
>> > below.  No error where produced and no output.
>> >
>> >  <h:selectOneRadio id="reportName" value="selectedReport">
>> >    <t:dataTable newspaperColumns="2" value="#{predefinedReports}"
>> >                 var="report" >
>> >      <h:column>
>> >        <f:selectItem itemValue="#{report.name}" />
>> >      </h:column>
>> >    </t:dataTable>
>> >  </h:selectOneRadio>
>> >
>> > Should this work?
>> >
>> >
>> > Paul Spencer
>> >
>> >
>> > Paul Spencer wrote:
>> >> Volker,
>> >>
>> >> The examples are in panelstack.jsp and selectbox.jsp.  <t:radio>
does
>> >> not appear to be work well with a dynamic list of selectItems,
i.e.
>> >> the select items are from a backing bean and they are to be
displayed
>> >> in 2 columns.
>> >>
>> >>
>> >> Paul Spencer
>> >>
>> >> Volker Weber wrote:
>> >>> Hi,
>> >>>
>> >>> see
>> >>>  http://myfaces.apache.org/tomahawk/tlddoc/t/radio.html
>> >>>
>> >>> there should be an example in simple.war
>> >>>
>> >>> regards,
>> >>>
>> >>>    Volker
>> >>>
>> >>>
>> >>> 2006/6/14, Paul Spencer <pa...@apache.org>:
>> >>>> Fintan,
>> >>>> Visually is it is the same concept, but how do I implement it
with
>> with
>> >>>> radio buttons?
>> >>>>
>> >>>> I have seen references to the layout "spread", but I have not
seen
>> an
>> >>>> example of it's use. So I am not sure if this is the solution.
>> >>>>
>> >>>> BTW the Newspaper Table has been deprecated.
>> >>>>
>> >>>> Paul Spencer
>> >>>>
>> >>>>
>> >>>> Conway. Fintan (IT Solutions) wrote:
>> >>>> > Hi Paul,
>> >>>> >
>> >>>> > Would the Newspaper Table component work?
>> >>>> > http://myfaces.apache.org/tomahawk/newspaperTable.html
>> >>>> >
>> >>>> > Regards,
>> >>>> >
>> >>>> > Fintan
>> >>>> >
>> >>>> > -----Original Message-----
>> >>>> > From: Paul Spencer [mailto:paulsp@apache.org]
>> >>>> > Sent: 13 June 2006 17:57
>> >>>> > To: MyFaces Discussion
>> >>>> > Subject: How can I display radio buttons in 2 columns?
>> >>>> >
>> >>>> >
>> >>>> > I would like to display a long list of radio buttons in 3
columns?
>> >>>> >
>> >>>> > Paul Spencer
>> >>>> >
>> >>>> >
>> >>>> > * ** *** ** * ** *** ** * ** *** ** *
>> >>>> > This email and any files transmitted with it are confidential
and
>> >>>> > intended solely for the use of the individual or entity to
whom
>> they
>> >>>> > are addressed.
>> >>>> > Any views or opinions presented are solely those of the
author,
>> >>>> and do not necessarily  represent those of ESB.
>> >>>> > If you have received this email in error please notify the
sender.
>> >>>> >
>> >>>> > Although ESB scans e-mail and attachments for viruses, it does
not
>> >>>> guarantee
>> >>>> > that either are virus-free and accepts no liability for any
damage
>> >>>> sustained
>> >>>> > as a result of viruses.
>> >>>> >
>> >>>> > * ** *** ** * ** *** ** * ** *** ** *
>> >>>> >
>> >>>> >
>> >>>>
>> >>>>
>> >>>
>> >>
>> >>
>> >
>> >
>>
>>
> 
> 
-- 
View this message in context:
http://www.nabble.com/How-can-I-display-radio-buttons-in-2-columns--tf17
81389.html#a5203554
Sent from the MyFaces - Users forum at Nabble.com.






Re: How can I display radio buttons in 2 columns? (Solved and Documented

Posted by Matt Stine <Ma...@STJUDE.ORG>.
Hi, all.  I've been trying to solve a similar problem using Paul's wiki
documentation.  Basically I'm trying to display a set of dynamic checkboxes
in multiple columns.  Here is a code snippet from my JSP:

<t:dataTable newspaperColumns="2" var="row"
value="#{publicationForm.sharedResourceDataModel}"
                     rowIndexVar="index">
    <t:selectManyCheckbox id="sharedResourceCheckboxes" layout="spread"
                                    
value="#{publicationForm.sharedResources}">
        <f:selectItems value="#{publicationForm.sharedResourceList}"/>
    </t:selectManyCheckbox>
    <h:column>
        <t:checkbox for="sharedResourceCheckboxes" index="#{index}"/>
    </h:column>
</t:dataTable>

Now, here's my problem.  When I arrive at this JSP, the checkboxes are
initialized with the values contained in #{publicationForm.sharedResources}. 
However, if I modify the selections at all and submit, those changes are
ignored.

Does anyone have any idea what may be going on?  If you need any more
information, please let me know.

Thanks!

Matt Stine
Senior Software Engineer
St. Jude Children's Research Hospital
Memphis, TN
matt.stine@stjude.org


Bruno Aranda wrote:
> 
> Thanks Paul!
> 
> Bruno
> 
> On 6/26/06, Paul Spencer <pa...@apache.org> wrote:
>> Based on post to this thread and some trail & error, I have found a
>> solution and documented it in the wiki.
>>    http://wiki.apache.org/myfaces/Display_Radio_Buttons_In_Columns
>>
>> Paul Spencer
>>
>>
>> Paul Spencer wrote:
>> > I thought about using a <t:dataTable> inside <h:selectOneRadio>, see
>> > below.  No error where produced and no output.
>> >
>> >  <h:selectOneRadio id="reportName" value="selectedReport">
>> >    <t:dataTable newspaperColumns="2" value="#{predefinedReports}"
>> >                 var="report" >
>> >      <h:column>
>> >        <f:selectItem itemValue="#{report.name}" />
>> >      </h:column>
>> >    </t:dataTable>
>> >  </h:selectOneRadio>
>> >
>> > Should this work?
>> >
>> >
>> > Paul Spencer
>> >
>> >
>> > Paul Spencer wrote:
>> >> Volker,
>> >>
>> >> The examples are in panelstack.jsp and selectbox.jsp.  <t:radio> does
>> >> not appear to be work well with a dynamic list of selectItems, i.e.
>> >> the select items are from a backing bean and they are to be displayed
>> >> in 2 columns.
>> >>
>> >>
>> >> Paul Spencer
>> >>
>> >> Volker Weber wrote:
>> >>> Hi,
>> >>>
>> >>> see
>> >>>  http://myfaces.apache.org/tomahawk/tlddoc/t/radio.html
>> >>>
>> >>> there should be an example in simple.war
>> >>>
>> >>> regards,
>> >>>
>> >>>    Volker
>> >>>
>> >>>
>> >>> 2006/6/14, Paul Spencer <pa...@apache.org>:
>> >>>> Fintan,
>> >>>> Visually is it is the same concept, but how do I implement it with
>> with
>> >>>> radio buttons?
>> >>>>
>> >>>> I have seen references to the layout "spread", but I have not seen
>> an
>> >>>> example of it's use. So I am not sure if this is the solution.
>> >>>>
>> >>>> BTW the Newspaper Table has been deprecated.
>> >>>>
>> >>>> Paul Spencer
>> >>>>
>> >>>>
>> >>>> Conway. Fintan (IT Solutions) wrote:
>> >>>> > Hi Paul,
>> >>>> >
>> >>>> > Would the Newspaper Table component work?
>> >>>> > http://myfaces.apache.org/tomahawk/newspaperTable.html
>> >>>> >
>> >>>> > Regards,
>> >>>> >
>> >>>> > Fintan
>> >>>> >
>> >>>> > -----Original Message-----
>> >>>> > From: Paul Spencer [mailto:paulsp@apache.org]
>> >>>> > Sent: 13 June 2006 17:57
>> >>>> > To: MyFaces Discussion
>> >>>> > Subject: How can I display radio buttons in 2 columns?
>> >>>> >
>> >>>> >
>> >>>> > I would like to display a long list of radio buttons in 3 columns?
>> >>>> >
>> >>>> > Paul Spencer
>> >>>> >
>> >>>> >
>> >>>> > * ** *** ** * ** *** ** * ** *** ** *
>> >>>> > This email and any files transmitted with it are confidential and
>> >>>> > intended solely for the use of the individual or entity to whom
>> they
>> >>>> > are addressed.
>> >>>> > Any views or opinions presented are solely those of the author,
>> >>>> and do not necessarily  represent those of ESB.
>> >>>> > If you have received this email in error please notify the sender.
>> >>>> >
>> >>>> > Although ESB scans e-mail and attachments for viruses, it does not
>> >>>> guarantee
>> >>>> > that either are virus-free and accepts no liability for any damage
>> >>>> sustained
>> >>>> > as a result of viruses.
>> >>>> >
>> >>>> > * ** *** ** * ** *** ** * ** *** ** *
>> >>>> >
>> >>>> >
>> >>>>
>> >>>>
>> >>>
>> >>
>> >>
>> >
>> >
>>
>>
> 
> 
-- 
View this message in context: http://www.nabble.com/How-can-I-display-radio-buttons-in-2-columns--tf1781389.html#a5203554
Sent from the MyFaces - Users forum at Nabble.com.