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
Raj88Raj88 

Make a picklist Mandatory based on another picklist value selected in VF page

I have 2 picklist values in a custom VF page. Finance__c and Type__c. If i select a value in Finance the Type__c picklist should become mandatory field. If i select the other value in Finance the Type__c picklist value should not be mandatory field. How can we achieve this using VF page.? Can anyone help me with this?

User-added image
User-added image
David ZhuDavid Zhu
If finance__c and type__c are in the same custom object, you can use validation rule to do it. point and click. no code needed.
Raj88Raj88
Hi David
Thanks for the reply. But can we make red borders for these mandatory fields like this. Because in validation rule we cant make this red border.
User-added image