You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by xianwinwin <xi...@gmail.com> on 2008/02/13 22:27:39 UTC
radio tag - how to have the items order vertically?
Hi there,
I have a list of items ordered on my jsp page with a radio buttons:
<s:radio name="fruitsname" list="fruits" />
my question is how to have the list vertically? (I get it horizontally)
I tried to dig the info from
http://struts.apache.org/2.x/docs/radio.html
but couldn't get it right
thanks for any pointers!
--
View this message in context: http://www.nabble.com/radio-tag---how-to-have-the-items-order-vertically--tp15468384p15468384.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: radio tag - how to have the items order vertically?
Posted by xianwinwin <xi...@gmail.com>.
THANK YOU Jeromy
this solved the question I presented.
Jeromy Evans - Blue Sky Minds wrote:
>
> xianwinwin wrote:
>> Thank you Jeramy!
>> I tried to use the cssStyle for a while and came up with this:
>>
>> <s:radio cssStyle="{display: block;}" label="Group"
>> name="groupSelect"
>> list="groups" />
>>
>
> Unfortunately the the cssStyle is applied to the input, not to the label
> as well. As you're using a list to create the radio buttons you have
> little option but to create a custom theme.
> Alternatively you could still use theme="simple" and an s:iterator to
> list them add and labels and breaks.
>
> However, creating a custom theme is much easier than it first seems.
>
> 1. create a directory "template" in your src directory. If you use
> maven that means src/main/resources/template. I any case it needs to be
> deployed at /WEB-INF/classes/template
>
> 2. create a directory template/mytheme. This is the name of your theme
>
> 3. create a file in template/mytheme/ called theme.properties containing:
> parent = simple
> That means that if you haven't provided a template in your theme, the
> template manager will search the simple theme for the template
>
> 4. COPY the following files to template/mytheme/:
>
> jar:struts2-core-2.0.9.jar!/template/simple/radiomap.ftl
>
> 5. Edit the file and add a <br/> after the </label>
>
> Optional 5a. If you're using the xhtml theme or css_xhtml theme by
> default, you may want to include the control header and footer.
> Add the following file to the start
> <#include "/${parameters.templateDir}/xhtml/controlheader.ftl" />
> and end of the file:
> <#include "/${parameters.templateDir}/xhtml/controlfooter.ftl" /><#nt/>
> (Substitute css_xhtml if preferred). Have a look at radiomap.ftl in
> these themes for examples.
>
> 6. Reference the theme when you use the radio:
>
> <s:radio theme="mytheme" label="Group" name="groupSelect" list="groups" />
>
> That's it
>
> Hope that helps,
> Jeromy Evans
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/radio-tag---how-to-have-the-items-order-vertically--tp15468384p15547134.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: radio tag - how to have the items order vertically?
Posted by Jeromy Evans <je...@blueskyminds.com.au>.
Dave Newton wrote:
> --- Jeromy Evans <je...@blueskyminds.com.au> wrote:
>
>> Unfortunately the the cssStyle is applied to the input, not to the label
>> as well.
>>
>
> On this note I'm wondering if anybody has any desire for the default theme to
> have things like label styles, an "id" on the <tr...> (which I need for
> hiding/showing etc) and whatnot.
>
> Dave
>
That's a definite yes from me.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: radio tag - how to have the items order vertically?
Posted by Dave Newton <ne...@yahoo.com>.
--- Jeromy Evans <je...@blueskyminds.com.au> wrote:
> Unfortunately the the cssStyle is applied to the input, not to the label
> as well.
On this note I'm wondering if anybody has any desire for the default theme to
have things like label styles, an "id" on the <tr...> (which I need for
hiding/showing etc) and whatnot.
Dave
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: radio tag - how to have the items order vertically?
Posted by Jeromy Evans <je...@blueskyminds.com.au>.
xianwinwin wrote:
> Thank you Jeramy!
> I tried to use the cssStyle for a while and came up with this:
>
> <s:radio cssStyle="{display: block;}" label="Group" name="groupSelect"
> list="groups" />
>
Unfortunately the the cssStyle is applied to the input, not to the label
as well. As you're using a list to create the radio buttons you have
little option but to create a custom theme.
Alternatively you could still use theme="simple" and an s:iterator to
list them add and labels and breaks.
However, creating a custom theme is much easier than it first seems.
1. create a directory "template" in your src directory. If you use
maven that means src/main/resources/template. I any case it needs to be
deployed at /WEB-INF/classes/template
2. create a directory template/mytheme. This is the name of your theme
3. create a file in template/mytheme/ called theme.properties containing:
parent = simple
That means that if you haven't provided a template in your theme, the
template manager will search the simple theme for the template
4. COPY the following files to template/mytheme/:
jar:struts2-core-2.0.9.jar!/template/simple/radiomap.ftl
5. Edit the file and add a <br/> after the </label>
Optional 5a. If you're using the xhtml theme or css_xhtml theme by
default, you may want to include the control header and footer.
Add the following file to the start
<#include "/${parameters.templateDir}/xhtml/controlheader.ftl" />
and end of the file:
<#include "/${parameters.templateDir}/xhtml/controlfooter.ftl" /><#nt/>
(Substitute css_xhtml if preferred). Have a look at radiomap.ftl in
these themes for examples.
6. Reference the theme when you use the radio:
<s:radio theme="mytheme" label="Group" name="groupSelect" list="groups" />
That's it
Hope that helps,
Jeromy Evans
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: radio tag - how to have the items order vertically?
Posted by xianwinwin <xi...@gmail.com>.
Thank you Jeramy!
I tried to use the cssStyle for a while and came up with this:
<s:radio cssStyle="{display: block;}" label="Group" name="groupSelect"
list="groups" />
the result came up with a 'twist' the name-of-group comes after the radio
button
image --> http://aycu20.webshots.com/image/43859/2003464400042803302_fs.jpg
any idea how to fix it, so it will be on the same line (and have the buttons
vertically)?
THANK YOU!
--
View this message in context: http://www.nabble.com/radio-tag---how-to-have-the-items-order-vertically--tp15468384p15509849.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: radio tag - how to have the items order vertically?
Posted by Jeromy Evans <je...@blueskyminds.com.au>.
When you use theme="simple" the radio buttons are rendered as plain html
inputs:
eg. <input type="radio" name="...
You can simply lay theme out using HTML or css:
eg.
with line breaks:
<s:radio .../><br/><s:radio .../><br/>
with css:
input['type='radio'] {
display: block;
}
or within a table.
If you're using the radios from a list it may be easier to override the
template to include a <br/> between each item.
xianwinwin wrote:
> you suggested:
>
> Use theme="simple" on the radio then add breaks between each radio
> button; or
>
> Q: what do you mean by "add breaks between each radio
> button"
>
> Thank you!
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: radio tag - how to have the items order vertically?
Posted by xianwinwin <xi...@gmail.com>.
is there any concrete example of how to modify an existing <s:radio.../>
template,
thanks!
--
View this message in context: http://www.nabble.com/radio-tag---how-to-have-the-items-order-vertically--tp15468384p15492763.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: radio tag - how to have the items order vertically?
Posted by Dave Newton <ne...@yahoo.com>.
--- xianwinwin <xi...@gmail.com> wrote:
> you suggested:
>
> Use theme="simple" on the radio then add breaks between each radio
> button; or
>
> Q: what do you mean by "add breaks between each radio
> button"
You'll probably need to either: modify an existing <s:radio.../> template,
create your own, or play around with CSS to force it to render how you want.
Dave
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: radio tag - how to have the items order vertically?
Posted by xianwinwin <xi...@gmail.com>.
you suggested:
Use theme="simple" on the radio then add breaks between each radio
button; or
Q: what do you mean by "add breaks between each radio
button"
Thank you!
--
View this message in context: http://www.nabble.com/radio-tag---how-to-have-the-items-order-vertically--tp15468384p15492163.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: radio tag - how to have the items order vertically?
Posted by Jeromy Evans <je...@blueskyminds.com.au>.
xianwinwin wrote:
> Hi there,
>
> I have a list of items ordered on my jsp page with a radio buttons:
>
>
> <s:radio name="fruitsname" list="fruits" />
>
>
> my question is how to have the list vertically? (I get it horizontally)
> I tried to dig the info from
> http://struts.apache.org/2.x/docs/radio.html
> but couldn't get it right
>
>
> thanks for any pointers!
>
Use theme="simple" on the radio then add breaks between each radio
button; or
Create a custom theme for the radiolist:
http://struts.apache.org/2.x/docs/themes-and-templates.html
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org