YasuDevil
YasuDevil

Reputation: 480

Placing label before radio button with JSF

i have the following in my page.

<h:selectOneRadio layout="pageDirection" >
     <s:selectItems value="#{usageList}" var="entry" 
      label="#{labels[entry.label]}" itemValue="entry" />
</h:selectOneRadio>

With this code I get a radio Button and after it the label of the same.

[ ] User

[ ] Administrator

But I want to do the following.

User [ ]

Administrator [ ]

Is it possible to do that with that using selectItems and selectOneRadio, or should I create the entries one by one.

Upvotes: 1

Views: 5694

Answers (1)

BalusC
BalusC

Reputation: 1108632

If it is not a language matter (for which the dir="rtl" as mentioned in McDowell's (currently deleted?) post would not have been appropriate as it has more side-effects), then you can also just use CSS for this. It's good to know that the <h:selectOneRadio> renders a table with buttons and labels in the same cell. This way you could just let the button float to the right and also align the cell's text (the label) to right.

Basic CSS example:

.radioright td {
    text-align: right;
}
.radioright td input {
    float: right;
}

Apply styleClass="radioright" on the <h:selectOneRadio> and you'll be fine.

Upvotes: 2

Related Questions