1

I have a requirement, where I have to make custom field enable and disable on the basis of a chosen value of a Picklist field.

I have Picklist field Pricing_Option__c which has 3 values : Lowest Doscount, Specific Discount, and Highest Discount.

There is another field : Specific_Discount__c (Datatype Percent)

My requirement is : Specific_Discount__c will always be disabled, unless Pricing_Option__c = "Specific Discount"

What I have done :

I can make the Specific_Discount__c field enable and disable based on value of Pricing_Option__c.

But I want Specific_Discount__c would be enabled and disabled as soon as we change the picklist value,

Is there something we can do with <apex:inputField /> onChange attribute

3

Refer this post that explains how to show/hide a field based on picklist modification. You can make some changes to change the behaviour to enable/ disable instead of show/hide.

Use the

<apex:actionSupport event="onchange" reRender="xxx"  /> 

Make sure to chose the rRender scope/ actionRegion correctly so that it includes the custom field that you want to disable.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.