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
vinod Sanubalavinod Sanubala 

VisualForce script not working, when trying to hide field based on picklist on customobject

I  have picklist field called "Novated_opportunity__c", when 'yes' is selected, need to hide "Outline_of_the_Novated_opportunity__c"

I am using below script, no error's however no result.

<apex:page standardController = "Pricing_Request__c" showHeader="true" >
    <apex:form>
        <apex:outputPanel id="t1">
            <apex:pageBlock>
                <apex:pageBlockSection title="Novated leases">
                    <apex:inputField value="{!Pricing_Request__c.Novated_opportunity__c}" >
                    
                        <apex:actionSupport event="onchange" rerender="t1" />
                    </apex:inputField>
                </apex:pageBlockSection>
                
                <apex:pageBlockSection title="Novated leases">
                    <apex:inputField value="{!Pricing_Request__c.Outline_of_the_Novated_opportunity__c}" rendered="{!IF( Pricing_Request__c.Novated_opportunity__c == 'Yes', true, false )}" >
                        <apex:actionSupport event="onchange" rerender="t1" />
                    </apex:inputField>
                    
                </apex:pageBlockSection>
            </apex:pageBlock> 
        </apex:outputPanel>
    </apex:form>
</apex:page>


Thanks,
Vinod
vinod Sanubalavinod Sanubala
tring this code as well, no luck :(

<apex:page standardController = "Pricing_Request__c" >
    <apex:form>
        <apex:outputPanel id="t1">
            <apex:pageBlock>
                <apex:pageBlockSection>
                    <apex:inputField value="{!Pricing_Request__c.Novated_opportunity__c}" >
                    <apex:actionSupport event="onchange" rerender="t1" />
                     </apex:inputField>  
                    <apex:inputField value="{!Pricing_Request__c.Outline_of_the_Novated_opportunity__c}" rendered="{!IF( Pricing_Request__c.Novated_opportunity__c == 'Yes', true, false )}" />
                </apex:pageBlockSection>
            </apex:pageBlock> 
        </apex:outputPanel>
    </apex:form>
</apex:page>
Sampath SuranjiSampath Suranji
Hi,
Try something like below,
<apex:page standardController = "Pricing_Request__c" showHeader="true" >
    <apex:form>
        <apex:outputPanel id="t1">
            <apex:pageBlock>
                <apex:pageBlockSection title="Novated leases">
                    <apex:inputField value="{!Pricing_Request__c.Novated_opportunity__c}" >
                    
                        <apex:actionSupport event="onchange" rerender="outline" />
                    </apex:inputField>
                </apex:pageBlockSection>
                
                <apex:pageBlockSection title="Novated leases" id="outline">
                    <apex:inputField value="{!Pricing_Request__c.Outline_of_the_Novated_opportunity__c}" rendered="{!IF( Pricing_Request__c.Novated_opportunity__c == 'Yes', true, false )}" >
                        <apex:actionSupport event="onchange" rerender="t1" />
                    </apex:inputField>
                    
                </apex:pageBlockSection>
            </apex:pageBlock> 
        </apex:outputPanel>
    </apex:form>
</apex:page>
regards

 
Raj R.Raj R.
Before 
<apex:inputField value="{!Pricing_Request__c.Outline_of_the_Novated_opportunity__c}" rendered="{!IF( Pricing_Request__c.Novated_opportunity__c == 'Yes', true, false )}" />

After
<apex:inputField value="{!Pricing_Request__c.Outline_of_the_Novated_opportunity__c}" rendered="{!Pricing_Request__c.Novated_opportunity__c == 'No'}" />