function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
RobertKafarskiRobertKafarski 

selectRadio with some options extended by inputText?

I would like to layout a few radio options such way that they would align nicely with text fields.

A simple example:

 

o Every Weekday

o Every [text box] day(s)

o Weekly etc..

 

 

Salesforce task edit layout (recurrence section) shows exactly what I am looking for but it does not seem to be achievable in Visualforce in a straight forward way.

 

Any suggestions are appreciated.

Arun MKArun MK

 

Hi,

 

You should mention the attribute layout="pageDirection" for apex:selectRadio tag.

So, your code should be something like this.

 

<apex:selectRadio value="{!color}" layout="pageDirection">

    <apex:selectOption itemValue="red" itemLabel="Red"/>
    <apex:selectOption itemValue="white" itemLabel="White"/>
    <apex:selectOption itemValue="blue" itemLabel="Blue"/>

</apex:selectRadio>

 

If this post is helpful please throw Kudos.If this post solves your problem kindly mark it as solution.

 

Regards,

Arun.

 

RobertKafarskiRobertKafarski

Arun_lister wrote:

 

Hi,

 

You should mention the attribute layout="pageDirection" for apex:selectRadio tag.

So, your code should be something like this.

 

<apex:selectRadio value="{!color}" layout="pageDirection">

    <apex:selectOption itemValue="red" itemLabel="Red"/>
    <apex:selectOption itemValue="white" itemLabel="White"/>
    <apex:selectOption itemValue="blue" itemLabel="Blue"/>

</apex:selectRadio>

 

If this post is helpful please throw Kudos.If this post solves your problem kindly mark it as solution.

 

Regards,

Arun.

 


Nope. The layout attribute does not address my issue as it simply tells visualforce to render the radio options in a closed html table. As I mentioned in my original post, I need to place a textbox beside a certain option that would look like it was a part of that option. Without some css hacks or unnecessarily complex visualforce/apex coding that I am trying to avoid, I do not see any simple way.

I could potentially define each option as an independent selectRadio component, lay them the way I wanted with my text boxes and mimic the radio effect using javascript and onclick events. My controller implementation would be a little difficult to understand by others, and I would not be proud of this workaround at all.