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
chanti kchanti k 

i want hide input field based on select value from picklist in visualforce page

Hi All,

i want hide input field based on select value from picklist in visualforce page
EX: Auto is text field and type is picklist. i have value of picklist (X, Y, Z). when ever i have select a value 'Y'  then i want hide Auto is text field.

Give me small Example.

Thanks in Advance,
Suraj TripathiSuraj Tripathi
Hi Chanti,

Below you can see a simple example that doesn't require the use of custom controller or controller extensions, so you can keep using just your standardController. You should be able to implement a similar logic for your page.
<apex:page standardController="Account" >  
    <apex:form >
         <apex:pageBlock title="New Account" >

                 <apex:pageBlockSection id="pbToRerender">                
                        <apex:inputField value="{!Account.Type}" >
                            <apex:actionSupport event="onchange"                             
                        <apex:inputField value="{!Account.AccountNumber}" rendered="{!Account.Type='Prospect'}">

             <apex:pageBlockSection >
                 <apex:inputField value="{!Account.Name}"></apex:inputField>

Basically, when you change the Account.Type the onchange event will be triggered,
 causing the re-rendering of the pageBlockSection. The actionRegion tag will make sure that only this limited part of the page is submitted and processed on the server. In the example above it allows the user to change the picklist without the need to input the Account.Name,
which is a required field.
However, if you want to do this "client-side" only, you can use JQuery to show/hide your checkbox when the picklist changes.

Kindly mark this as solved if it's resolved so that it gets removed from the unanswered queue which results in helping others who are encountering a similar issue.