Friday, March 4, 2016

Adding Picklist values conditionally on the Visualforce page

Hi All,

Thanks for appreciating my previous blog posts and sorry for the delay for in my new blogpost.

Today I am sharing with you, how can we add some picklist value on the visualforce page conditionally.
Scenario, Like if you have some requirement in which you don’t want to accept new record with some status or picklist value but you want to display that for existing records. You can’t consider inputField in that case as well. So the simple, easier and solution with less effort is:

Create a list in your Apex Controller and display on your Visualforce page with apex:selectlist and apex:selectoptions, so that all required field will be there and add the additional value by using apex:SelectOption with itemDisabled property by define the condition.


One more thing, I wanna share and ask, we have a rendered attribute for the apex:SelectionOption but I were not getting that property functional in my practice, so if anyone knows something about the reason, please share with me.

I will get back to you with my next post soon. Happy Coding J

Feel free to contact if you have anything in which I could help you.

Thanks,
Amit Goyal
Skype: amitgoyal09

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.