How to set a picklist default value if I dont have a controller. I currently using standard controller account.

<apex:page standardController="Account" showHeader="TRUE" label="Close Account" >
    <apex:sectionHeader subtitle="Account Closure" title=""/><br> </br>  
    <apex:form >
        <apex:pageBlock title="Please Input Account Closure Date" >
            <apex:pageBlockButtons >
                <apex:commandButton value="Save" action="{!Save}" />
                <apex:commandButton value="Cancel" action="{!Cancel}"/>
            <h1>Account Status: </h1>
              <apex:inputField value="{!Account.Account_Status__c}" label="Status" required="TRUE"/>
              <h1>Account Closure Date: </h1>
              <apex:inputField value="{!Account.Account_Closure_Date__c}" label="Close Date" required="TRUE"/>

  • Yes. You can always JS to default/set the values. Is there a challenge to default the picklist value for the field or for a particular recordType. Commented Mar 1, 2018 at 1:36

1 Answer 1


Assuming you also don't want to use an extension class, you can add an ID to the inputfield and select it with Javascript. Note that the ID in the ID attribute will be generated at the end of a larger ID, so you need to use the "ends with" selector ($=) to select the correct HTML element.

<apex:inputField value="{!Account.Account_Status__c}" label="Status" required="TRUE" id="accountStatus" />

    document.querySelector('[id$=accountStatus]').value = 'Default';
  • Thanks for this. I just wanna inquire also if there is a way to assign default value if the field is readonly on page. thanks for your help
    – begginers
    Commented Mar 1, 2018 at 2:05
  • I'm pretty sure this still works if it's readonly. Commented Mar 1, 2018 at 2:14

You must log in to answer this question.

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