+ Start a Discussion
RahulRahul 

Hello Friends, I want to show the phone input field when rating="warm". I think i have written the logic correctly, dont know why its not showing phone field when Rating is Warm. Need your help

<apex:page standardController="Account">
<apex:form id="myform">
<apex:pageBlock >
<apex:pageBlockSection id="theform" columns="1">


<apex:inputField value="{!Account.Rating}">
    <apex:actionSupport event="onchange" reRender="myform" />

</apex:inputfield>

<apex:inputField id="myform" value="{!Account.phone}" rendered="{!Account.Rating == 'warm'}"  ></apex:inputField>

</apex:pageBlockSection>

</apex:pageBlock>

</apex:form>
  
</apex:page>
Best Answer chosen by Rahul
Ramesh DepaiahRamesh Depaiah
@sumit
Here is the working code, Please let me know 
<apex:page standardController="Account">
<apex:form id="myform">
<apex:pageBlock >
<apex:pageBlockSection id="theform" columns="1">
 <apex:actionRegion>
       <apex:inputField value="{!Account.Rating}">
       <apex:actionSupport event="onchange" action="{!null}" rerender="myform"/>  
       </apex:inputField>
   </apex:actionRegion>
  <apex:outputPanel id="myform" > 
       <apex:outputPanel rendered="{!If(Account.Rating == 'Warm',true,false)}">
           <apex:inputField value="{!Account.phone}"/>
       </apex:outputPanel> 
   </apex:outputPanel> 
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>  
</apex:page>

Thanks
Ramesh

All Answers

Khan AnasKhan Anas (Salesforce Developers) 
Hi Sumit,

Greetings to you!

I have checked your code in my org and the issue is related to picklist values. If you use Warm instead of warm (case-sensitive) then it will work. However, picklist values are case insensitive so, currently, this might be the issue from Salesforce side.

Also, don't use the same id for different visualforce tags.

I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks and Regards,
Khan Anas
Ramesh DepaiahRamesh Depaiah
@sumit
Here is the working code, Please let me know 
<apex:page standardController="Account">
<apex:form id="myform">
<apex:pageBlock >
<apex:pageBlockSection id="theform" columns="1">
 <apex:actionRegion>
       <apex:inputField value="{!Account.Rating}">
       <apex:actionSupport event="onchange" action="{!null}" rerender="myform"/>  
       </apex:inputField>
   </apex:actionRegion>
  <apex:outputPanel id="myform" > 
       <apex:outputPanel rendered="{!If(Account.Rating == 'Warm',true,false)}">
           <apex:inputField value="{!Account.phone}"/>
       </apex:outputPanel> 
   </apex:outputPanel> 
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>  
</apex:page>

Thanks
Ramesh
This was selected as the best answer
RahulRahul
Thank you very much guys for help :) Its Really helpful for me.