+ Start a Discussion
Anirudh Sharma 5Anirudh Sharma 5 

Showing error when they select specific pick list value

I have a requirement where the field is pick list and I have two values in that YES and NO. So when they click yes a field should pop up which is done but when they click NO an error message should be shown to the user. Can you guys help me how to do that. And this is a VF page,

Thanks
sharathchandra thukkanisharathchandra thukkani
make uses of ApexPages.addMessage and visualforce component <apex:pageMessages>

see below link 

http://www.sfdcpoint.com/salesforce/show-error-message-visualforce-page/
pconpcon
It sounds like you're looking for someone to write the code for this project. These forums are not meant for that; you'll want to post over on the AppExchange site [1] where you can match up with a developer looking to work on your project.  If you have already tried to do this and have specific code that you are having problems with, please include it here and we will try to help you with your issue.

There are lots of ways that you can acheive this in Visualforce from using a onchange [2], to a custom onChange action in your controller to a controller side error checking that rejects the save and adds an apex message [3] to alert the user.

NOTE: When adding code please use the "Add a code sample" button (icon <>) to increase readability and make it easier to reference.

[1] https://appexchange.salesforce.com/developers
[2] https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_selectList.htm
[3] https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_pages_message.htm