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
ben ben 2ben ben 2 

Restrict chosing onr of the option of a picklist field

Hello,
If I have a picklist field with 4 options
a,
b,
c,
d.

Yet when they try to selct D they get a validation error "This option is not available at this time" so it will not allow them to select that option. How do go about implementing that?

Thanks,

Ben
Amit Chaudhary 8Amit Chaudhary 8
Please try all three option :-

Option 1:- Create one record type and remove picklist value
Option 2:- create one validation rule on picklist value "D".
Option 3:- Try below code
<apex:selectList id="chooseColor" value="{!string}" size="1">
            <apex:selectOption itemValue="a" itemLabel="a"/>
            <apex:selectOption itemValue="b" itemLabel="b"/>
            <apex:selectOption itemValue="c" itemLabel="c"/>
			<apex:selectOption itemValue="d" itemLabel="d" itemDisabled="true"/>
   </apex:selectList>

Please let us know if this will help you.

Thanks,
Amit Chaudhary