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
Aishwarya P 4Aishwarya P 4 

mandatory field on condition

I have a visual force page, which has two fields.
Field 1 : Order status (Type : picklist) : it has 4 values 
New
WIP
Closed
Cancelled

Field 2 : Cancellation reason (type : picklist) : it has two values
Issue Solved
Not required

So when i select cancelled option from field 1, then field 2 should become editable else it should be read only.
and if cancelled is selected in field 1 then you cannot save without the cancellation reason.

Please help me write the vf page and vf controller class.
Naveen DhanarajNaveen Dhanaraj
Try This,
AND(
ISPICKVAL( Order_status__c, ' Cancelled '),
ISBLANK( Cancellation_reason__c ) )