You need to sign in to do that
Don't have an account?
Andrew Hoban 6
Making a Radio Button a Default Value from Picklist
Hi all,
I have created radio buttons that uses a Picklist field. Is there a way of maing one of the values default?
I need the 'Not Required' value to be default.
Many thanks
I have created radio buttons that uses a Picklist field. Is there a way of maing one of the values default?
I need the 'Not Required' value to be default.
Many thanks
<apex:page standardController="Everton_Users__c" showHeader="true" > <apex:sectionHeader title="Everton Users" subtitle="New Everton User"/> <apex:form > <apex:pageblock mode="edit" > <apex:pageBlockButtons location="both"> <apex:commandButton value="Save" action="{!save}"/> <apex:commandButton value="Cancel" action="{!cancel}"/> </apex:pageBlockButtons> <apex:pageBlockSection title="Information" columns="2"> <apex:inputField value="{!Everton_Users__c.name}" Required="True"/> <apex:inputField value="{!Everton_Users__c.Start_Date__c}"/> </apex:pageBlockSection> <apex:pageblockSection title="ITSS Signed Policies" columns="1" > <apex:inputField value="{!Everton_Users__c.ITSS_Acceptable_Usage_Policy__c}"/> </apex:pageblocksection> <apex:pageblockSection title="Equipment Control" columns="2" > <apex:selectRadio label="Sharefile:" value="{!Everton_Users__c.Sharefile__c}" required="true" style="margin-top: -10px;"> <apex:selectOption itemLabel="Not Required" itemvalue="Not Required"/> <apex:selectOption itemLabel="Required" itemvalue="Required"/> <apex:selectOption itemLabel="Enabled" itemvalue="Enabled"/> <apex:selectOption itemLabel="Disabled" itemvalue="Disabled"/> </apex:selectRadio> </apex:pageblocksection> </apex:pageblock> </apex:form> </apex:page>
Hope this helps,
Fred
All Answers
You have to prepopulate the field value before to display the selectRadio using a setter.
Here is an example http://salesforce.stackexchange.com/questions/12109/default-value-radio-button.
Regards,
Fred
Ideally I would like the radio buttons to work off the picklist (safarefile) I have created. Thanks
I'm not sure to understand exactly what you'd like to do.
To retrieve picklist values have a look here http://salesforce.stackexchange.com/questions/4992/how-to-get-a-picklist-all-values-in-apex-controller
I am basically trying to change the view of a picklist to radio buttons. This has been achieved, however when the page first loads I wish not required to be selected. I have done this in a controller similar to the first example however that was not related to a picklist and its values. I am unsure how to relate the piklist and its values in a controller/
Im sorry if I am not making sense.
Thanks
Hope this helps,
Fred
Thank you
Kindly mark the more helpfull answer as the best one and mark the question as Solved.
Thanks,
Fred