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
Akshay ShrivastavaAkshay Shrivastava 

vsualforce field mandatory

 I want to Make a picklist called "Reason" to be mandatory when the value on another picklist called "Status" equals to decline. How can this achieve on visualforce page?
Best Answer chosen by Akshay Shrivastava
AbhinavAbhinav (Salesforce Developers) 
Hi Akshay,

Have you checked suggestion provided in below link?

https://salesforce.stackexchange.com/questions/88484/making-field-required-based-on-user-input-on-other-input-field

Thanks!

All Answers

AbhinavAbhinav (Salesforce Developers) 
Hi Akshay,

Have you checked suggestion provided in below link?

https://salesforce.stackexchange.com/questions/88484/making-field-required-based-on-user-input-on-other-input-field

Thanks!
This was selected as the best answer
Suraj Tripathi 47Suraj Tripathi 47
Hi Akshay Shrivastava
Greeting!

/*VisualForce picklist*/
<apex:selectList -(whatever you want inside)- required="{!Required}">
assuming that you know how to use picklist in visualforce.
/* apex*/
public boolean Required{get; set;}

Required=false;

public void isRequired(){
if(check status equals to decline)
{
Required=True;
}
else{
Required=False;
}
}
If you find your solution mark this as best answer.

Thank you!
Regards,
Suraj Tripathi