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
aiyaz_SFDCaiyaz_SFDC 

How to make a field show up based on a condition

Hi,

 

I know this sound a bit weird but i'm sure others may have done something like the following use case:

 

- Select a value from a Picklist field (eg. Other)

 

- when "Other" selected, a custom field will display below allowing the user to enter a value for "other"

 

Any ideas or best practices on such a use case scenario?

 

Any help will be great.

 

NPMNPM
Dependent Picklists work well for this.  It takes some work to figure out and may bee too much to dtail here.  I suggest you start by searching on Dependent Fields in Help and Training, and if you get stuck post specifics here for help.
aiyaz_SFDCaiyaz_SFDC

Thanks NPM.

 

Well I have used dependant picklists before, but between 2 picklists where the entries in the dependant picklist depends on what is selected from the Controlling picklist.  However, i'm trying to bring up a free-form text field after make a specific selection from a (controlling) picklist.  Is this possible?

NPMNPM

I do not think so as far as only having the field show up on the page if Other is selected. - maybe if you are a Visual Force developer?   As an alternative you could create a validation rule for the text field that requires an entry if Other is selected in the pick list.

 

A validation rule triggers when the formula evaluates to True so the logic would need to be:

 

Picklist field = Other and Text field is empty

AND( ISPICKVAL(picklistfieldname),"Other", LEN (textfieldname)=0)

You could expand this rule or add another rule that does not allow any entry in the text field if the picklist value selected is not Other, depending on your need.

 

 

aiyaz_SFDCaiyaz_SFDC

Thanks NPM,

 

I currently have a validation rule as a workaround which seems to be working fine.  I will check  this out on visualforce later for possibilities.