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
Saju NathSaju Nath 

Auto populate the picklist value to the text field

Is it possible to auto populate the picklist value to the text field in standard page. If so, can you please explain how to achieve it.
salesforce mesalesforce me
hi check this once............
<apex:pageBlock id="theBlock">
   <apex:inputCheckbox value="{!theSObject.CheckBox__c}">
      <apex:actionSupport event="onchange" rerender="theBlock"/>

   <apex:inputText value="{!theSObject.TextField__c}" disabled="false" rendered="{!(theSObject.CheckBox__c == true)}"/>
   <apex:inputText value="{!theSObject.TextField__c}" disabled="true" rendered="{!(theSObject.CheckBox__c != true)}"/>

   <!-- Or to simply have a field that appears only when the box is checked -->
   <apex:inputText value="{!theSObject.TextField__c}" rendered="{!(theSObject.CheckBox__c == true)}"/>

Saju NathSaju Nath
Thanks For the Response.
But we are not able to edit the standard page right.
Sumit Kumar Singh 9Sumit Kumar Singh 9
Hello Sanju, 

I don't think it's possible. 
You can have workflow to copy the picklist value to the text field.

Sumit Kumar Singh
Saju NathSaju Nath
Thanks Sumit,
Can you please explain, how to create a workflow for this sceneraio.
Rupal KumarRupal Kumar
Hi Sanju,
Setup a workflow rule where the condtions for the formula ( not criteria) is based on your ISCHANGED( Picklistfield ).

The field update will update the desired field using a formula and the formula will likely be something like:
your Text(textfield).

when the picklist value is changed to " ISCHANGED( Picklistfield )" the rule will fire and copy the value of the picklist field into your text field.

Rupal Kumar.
Sumit Kumar Singh 9Sumit Kumar Singh 9
Hello Rupal, 
I think, It should be Text(Picklistfield).

Sumit Kumar Singh
You set the picklist value in the edit page URL, for this you will have to override the New button and set the desired picklist value in overridden VF and redirect. Its called as URL hacking, more info here - (" target="_blank)
Sumit Kumar Singh 9Sumit Kumar Singh 9
Is it only for edit page? How would you pre decide which picklist value to send in the URL for new records? Do you have any magic stick which decides that user is goona choose this particular picklist value, and you send that particular value to the URL??

Sumit Kumar Singh.