1

For Apex:SelectRadio components do they always have a default value selected when first rendered on the visualforce page and when the selectOptions are specified directly in the visualforce page as opposed to from a list binded from the Controller?

For the following code "No" is selected as default when the page loads. I do not want a default option selected. Any help on how i can achieve this would be appreciated.

Thanks.

<apex:selectRadio value="{!triedToReturnCall}" id="returnedCall" layout="pageDirection" borderVisible="false" required="true">
    <apex:selectOption itemValue="true" itemLabel="Yes"/>
    <apex:selectOption itemValue="false" itemLabel="No"/>
</apex:selectRadio>   

1 Answer 1

0

FRed:

The doc states that SelectOption class is created as:

public SelectOption(String value, String label)

Hence, the value bound to the controller property triedToReturnCall will be a string. If you default (in the controller) triedToReturnCall to null, no radio button is default selected. Otherwise, SFDC looks for a match between the itemValue of the apex:selectOption and the value of triedToReturnCall to default the radio.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .