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
Nikhil SomvanshiNikhil Somvanshi 

Not clear on how to use Rendered

Hello Community,

My requirement is to display a field Provided_Cash_Amount__c if another field Cash_Provided__c only if it is populated as  'Yes'. I believe I can do it using Rendered, which I tried but couldn't get to work. Please look at the code below:

Visualforce Page:

<apex:page standardController="Response_Action_Plan__c" extensions="RapSaver"  tabStyle="Response_Action_Plan__c">
<apex:form >
<apex:pageBlock >
<apex:sectionHeader title="New Response Action Plan" />
<apex:pageBlockSection title="Information" collapsible="False" columns="1">

<apex:inputField value="{!}"/>
<apex:inputField value="{!RAP.Disaster__c}"/>
<apex:inputField value="{!RAP.Causalities_Attended__c}"/> 
<apex:inputField value="{!RAP.Staff_Allotted_Offshore__c}"/>
<apex:inputField value="{!RAP.Staff_Onsite__c}"/>
<apex:inputField value="{!RAP.Onsite_Staff_Count__c}"/>
<apex:inputField value="{!RAP.Blankets_Provided__c}"/>
<apex:inputField value="{!RAP.Number_of_Blankets_Provided__c}"/>
<apex:inputField value="{!RAP.Cash_Provided__c}"/> 
<apex:inputField value="{!RAP.Provided_Cash_Amount__c}" rendered="{!IF(RAP.Cash_Provided__c = 'Yes', true, false)}"/>

<apex:pageblockbuttons location="Bottom" >
<apex:commandbutton value="Save RAP" action="{!RapSaver}"/>

Extension Class:

Public class RapSaver
Public Response_Action_Plan__c RAP{get;set;}
Public ApexPages.StandardController Stcl{get;set;}

Public RapSaver(ApexPages.StandardController str)  
Stcl = str;

Public RapSaver()                           
RAP = new Response_Action_Plan__c();

Public PageReference RapSaver()
insert RAP;

PageReference pg = new PageReference ('/a07?fcf=00B7F000009BsJx');

return pg;




Nayana KNayana K
<apex:inputField value="{!RAP.Cash_Provided__c}" > 
<apex:actionSupport event="onchange" reRender="otherField" />
<apex:inputField value="{!RAP.Provided_Cash_Amount__c}" rendered="{!RAP.Cash_Provided__c == 'Yes'}" id="otherField"/>

Please try this once
Nikhil SomvanshiNikhil Somvanshi

Thanks Nayana,

I tried your suggestion but doesn't seem to work. Can you share any other suggestions on this  ?

Rajesh Varma MudunuriRajesh Varma Mudunuri
Please refer to the below post