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
DevSFDC22DevSFDC22 

Picklist in visualforce page

Hi,

How I can have the picklist value in visualforce pages. Example Yes and No value. Also how I can hide the next section if answer is no in visualforce.
VinayVinay (Salesforce Developers) 
Hi,

Check below examples.

https://jayakrishnasfdc.wordpress.com/2018/08/05/custom-picklist-in-visualforce-salesforce/#:~:text=Sometime%20there%20is%20requirement%20to,be%20done%20using%20inputfield%20tag.
https://www.salesforcetutorial.com/salesforce-picklist-example-visualforce-page/

Thanks,
Vinay Kumar
Abhishek Sharma 36Abhishek Sharma 36
<!-----------VF Page--------------->
<apex:page controller="chooseColor">
<apex:form id="TheForm">
<apex:selectList id="chooseColor" value="{!s}" size="1">
<apex:selectOption itemValue="yes" itemLabel="Yes"/>
<apex:selectOption itemValue="no" itemLabel="No"/>
<apex:selectOption itemValue="blue" itemLabel="Blue"/>
<apex:actionSupport event="onchange" action="{!Dummy}" rerender="TheForm"  />
</apex:selectList>
<table>
<tr>
<th>Value1:</th>
<td>{!s}</td>
</tr>
</table>
</apex:form>
</apex:page>


/*** Controller ***/
public class chooseColor {
public String s {get;set;}
}

Try this, in actionsupport, pass the id of the the block that you need to show, after chossing the value.