You need to sign in to do that
Don't have an account?
Rahul
Hi Friends, when Iam selecting Rating as Warm phone Number Input field should be displayed. I have achieved this using Standard controller but facing problems when doing it through extensions. Please find my code below.Need help
VF Page :-
<apex:page standardController="Account" extensions="acccontroller">
<apex:form >
<apex:pageBlock >
<apex:pageBlockSection id="theform" columns="1">
<apex:actionRegion >
<apex:outputLabel >hvb :</apex:outputLabel>
<apex:inputField value="{!acc.Rating}">
<apex:actionSupport event="onchange" action="{!null}" rerender="myform"/>
</apex:inputField>
</apex:actionRegion>
<apex:outputPanel id="myform" >
<apex:outputPanel rendered="{!If(acc.Rating == 'Warm',true,false)}">
<apex:outputLabel >hvb :</apex:outputLabel>
<apex:inputField value="{!acc.phone}"/>
</apex:outputPanel>
</apex:outputPanel>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
Apex Class :-
public class acccontroller {
public account acc{get;set;}
public acccontroller(ApexPages.StandardController controller) {
}
}
<apex:page standardController="Account" extensions="acccontroller">
<apex:form >
<apex:pageBlock >
<apex:pageBlockSection id="theform" columns="1">
<apex:actionRegion >
<apex:outputLabel >hvb :</apex:outputLabel>
<apex:inputField value="{!acc.Rating}">
<apex:actionSupport event="onchange" action="{!null}" rerender="myform"/>
</apex:inputField>
</apex:actionRegion>
<apex:outputPanel id="myform" >
<apex:outputPanel rendered="{!If(acc.Rating == 'Warm',true,false)}">
<apex:outputLabel >hvb :</apex:outputLabel>
<apex:inputField value="{!acc.phone}"/>
</apex:outputPanel>
</apex:outputPanel>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
Apex Class :-
public class acccontroller {
public account acc{get;set;}
public acccontroller(ApexPages.StandardController controller) {
}
}
Greetings to you!
Please try the below code, I have tested in my org and it is working fine. Kindly modify the code as per your requirement.
Visualforce:
Controller:
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
All Answers
Greetings to you!
Please try the below code, I have tested in my org and it is working fine. Kindly modify the code as per your requirement.
Visualforce:
Controller:
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