You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Rich Argo <ri...@pearson.com> on 2006/07/11 18:08:12 UTC

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

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?

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;
>