You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Andrew Robinson <an...@gmail.com> on 2006/07/21 18:38:40 UTC

selectBooleanCheckbox and it's text

I am pretty sure this has been asked before, but I can't find it in
the archives.

I am trying to put a checkbox on a page and have text with it.

I have the following code:
<t:selectBooleanCheckbox
  value="#{value}"
  styleClass="mystyle">
  <t:outputText value="#{msg.mytext}" />
</t:selectBooleanCheckbox>

What gets rendered is:
My text<input type="checkbox" ... class="mystyle" />

Should this not be:
<input type="checkbox" ... class="mystyle">My text</input>
?

Any way to do this or am I missing something? (BTW - this is the
tomahawk 1.1.3 control)

-Andrew

Re: selectBooleanCheckbox and it's text

Posted by Mike Kienenberger <mk...@gmail.com>.
There are probably better ways to do it, but this is how I've been doing it:

<t:selectBooleanCheckbox id="myId" value="#{value}" />
<h:outputLabel for="myId" value="#{msg.mytext}"/>

This might not work with your styleClass="mystyle" attribute, though.

I don't think t:selectBooleanCheckbox allows children, but check the
source to be sure.


On 7/21/06, Andrew Robinson <an...@gmail.com> wrote:
> I am pretty sure this has been asked before, but I can't find it in
> the archives.
>
> I am trying to put a checkbox on a page and have text with it.
>
> I have the following code:
> <t:selectBooleanCheckbox
>   value="#{value}"
>   styleClass="mystyle">
>   <t:outputText value="#{msg.mytext}" />
> </t:selectBooleanCheckbox>
>
> What gets rendered is:
> My text<input type="checkbox" ... class="mystyle" />
>
> Should this not be:
> <input type="checkbox" ... class="mystyle">My text</input>
> ?
>
> Any way to do this or am I missing something? (BTW - this is the
> tomahawk 1.1.3 control)
>
> -Andrew
>

Re: selectBooleanCheckbox and it's text

Posted by Andrew Robinson <an...@gmail.com>.
Will give it a try, thanks

On 7/21/06, Chandra Sekhar <sv...@lasersoft.co.in> wrote:
> Hi Andrew,
>
> You can do it by means of <h:outputLabel> and display your outputText by the
> side of your check Box because it gives you a attribute named "for" which
> refers to the Checkbox.
>
> Regds,
> Chandru.
>
>
> ----- Original Message -----
> From: "Andrew Robinson" <an...@gmail.com>
> To: "MyFaces Discussion" <us...@myfaces.apache.org>
> Sent: Friday, July 21, 2006 10:08 PM
> Subject: selectBooleanCheckbox and it's text
>
>
> >I am pretty sure this has been asked before, but I can't find it in
> > the archives.
> >
> > I am trying to put a checkbox on a page and have text with it.
> >
> > I have the following code:
> > <t:selectBooleanCheckbox
> >  value="#{value}"
> >  styleClass="mystyle">
> >  <t:outputText value="#{msg.mytext}" />
> > </t:selectBooleanCheckbox>
> >
> > What gets rendered is:
> > My text<input type="checkbox" ... class="mystyle" />
> >
> > Should this not be:
> > <input type="checkbox" ... class="mystyle">My text</input>
> > ?
> >
> > Any way to do this or am I missing something? (BTW - this is the
> > tomahawk 1.1.3 control)
> >
> > -Andrew
>
>

Re: selectBooleanCheckbox and it's text

Posted by Chandra Sekhar <sv...@lasersoft.co.in>.
Hi Andrew,

You can do it by means of <h:outputLabel> and display your outputText by the 
side of your check Box because it gives you a attribute named "for" which 
refers to the Checkbox.

Regds,
Chandru.


----- Original Message ----- 
From: "Andrew Robinson" <an...@gmail.com>
To: "MyFaces Discussion" <us...@myfaces.apache.org>
Sent: Friday, July 21, 2006 10:08 PM
Subject: selectBooleanCheckbox and it's text


>I am pretty sure this has been asked before, but I can't find it in
> the archives.
>
> I am trying to put a checkbox on a page and have text with it.
>
> I have the following code:
> <t:selectBooleanCheckbox
>  value="#{value}"
>  styleClass="mystyle">
>  <t:outputText value="#{msg.mytext}" />
> </t:selectBooleanCheckbox>
>
> What gets rendered is:
> My text<input type="checkbox" ... class="mystyle" />
>
> Should this not be:
> <input type="checkbox" ... class="mystyle">My text</input>
> ?
>
> Any way to do this or am I missing something? (BTW - this is the
> tomahawk 1.1.3 control)
>
> -Andrew