jQuery in Action, 2nd edition*
The moose likes JSF and the fly likes How can i achevie Space Between Two Radio Buttons Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "How can i achevie Space Between Two Radio Buttons" Watch "How can i achevie Space Between Two Radio Buttons" New topic
Author

How can i achevie Space Between Two Radio Buttons

S.Reddisekhar Reddy
Greenhorn

Joined: Jan 05, 2012
Posts: 29
Hi
This is my Code
I wrote Style in xhtml like:
</head>
<style type="text/css">
.myRadioCtrl span { padding-right: 20px; }
.myRadioClass td { width: 180px; }

</style>
<body>

And I am Using that Style class like:

<h:selectOneRadio id="countryDetails" enabledClass="black" styleClass="myRadioCtrl"
valueChangeListener="#{cc.attrs.showCounties}"
value="#{cc.attrs.countyIndicator}" label="" immediate="true"
required="true"
requiredMessage="#{cc.resourceBundleMap.requiredCounty}">
<f:selectItem itemValue="AllCountries"
itemLabel="#{cc.resourceBundleMap.labelAllCountries}" />
<f:selectItem itemValue="SelectedCounties"
itemLabel="#{cc.resourceBundleMap.labelSelectedCountries}" />
<f:ajax event="click" immediate="true"
render="pickListforCountries"></f:ajax>

</h:selectOneRadio>

and

<h:selectOneRadio id="reservationDetails" enabledClass="black" styleClass="myRadioClass"
value="#{cc.attrs.reservationIndicator}"
valueChangeListener="#{cc.attrs.showReservations}" label=""
required="true"
requiredMessage="#{cc.resourceBundleMap.requiredReseravation}"
immediate="true">
<f:selectItem itemValue="AllReservations"
itemLabel="#{cc.resourceBundleMap.labelAllReservations}" />
<f:selectItem itemValue="SelectedReservations"
itemLabel="#{cc.resourceBundleMap.labelSelectedReservations}" />
<f:ajax event="click" immediate="true"
render="pickListforReservations"></f:ajax>
</h:selectOneRadio>


But I didn't got the space between two RadioButtons
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15950
    
  19

Speaking of spacing, if you use the "Code" button on our message editor to wrap format tags around your xhtml, it will make things a lot more readable.

Also, it helps when giving examples to make them brief. The functional attributes that make up the bulk of your tags don't concern your problem, but they make it harder for us to see the problem.

As far as your layout issues go, I don't believe that this tag generates a span element, and if it does, I'm even less certain that you can set a padding on it. Your td style seems to have the wrong class name.


Customer surveys are for companies who didn't pay proper attention to begin with.
sriram Ganapathi
Greenhorn

Joined: Dec 19, 2012
Posts: 10
You can use the <p:spacer> to provide space between your radio butttons

like <hneRadio id="1"> <p:spacer height="0" width=""> <hneRadio id="2">

note : if you need both button on same line provide height as 0

please specify width according to your need


Regards,
Sriram.G
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15950
    
  19

sriram Ganapathi wrote:You can use the <p:spacer> to provide space between your radio butttons


Only if you are using PrimeFaces.

The p:spacer element is not part of the core JSF tag library set.

There is also the problem that the h:selectOneRadio renders all of the buttons from a single atomic element, so there is no place to insert a spacing element.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How can i achevie Space Between Two Radio Buttons
 
Similar Threads
validation in radio buttons
Setting default value to h: selectOneMenu on button click
Issue with jsf value change listener
Issue with Changing the h:selectoneRadio button
JSF 2.0 - Ajaxification of listboxes and menus