You need to sign in to do that
Don't have an account?
Aishwarya P 4
visual force doubt
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.
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.
Please refer below Salesforce help document which has the sample code for multi-dependent picklist.It can help you to start off.
https://help.salesforce.com/articleView?id=000181251&type=1
Hope this helps you!
If this helps you please mark it as solved.
Thanks and Regards
Sandhya
Approach 1 :
Standard approach is to create dependent picklist on salesforce :
https://help.salesforce.com/articleView?id=fields_defining_field_dependencies.htm&type=0
Approach 2
You can use jquery plugin to make dependent picklists in page, you can make editable or non editable another picklist.
Link to one of the plugin:
http://www.jqueryscript.net/form/Multilevel-Dependent-Dropdown-Plugin-With-jQuery-Dependent-Dropdowns.html
Another option is to add Onchange method on Parent Select list and in method check the value of parent picklist and disable the child picklist.
Thanks