You need to sign in to do that
Don't have an account?
Mohmad Sohel 2
visualforce reRender
Hi Guys,
I have wrote a vf page which is used to display input fields based on LeadSource. If LeadSource == 'web' then it should dispaly Description. But below code is not working..
Help me regarding this. Thank You
<apex:page standardController="Contact">
<apex:form >
<apex:pageBlock title="Enter Contact Information">
<apex:pageBlockButtons >
<apex:commandButton value="Save" action="{!Save}" />
</apex:pageBlockButtons>
<apex:pageBlockSection columns="1">
<apex:inputField value="{!Contact.LastName}" />
<apex:pageBlockSectionItem >
<apex:outputLabel value="Lead Source"/>
<apex:actionRegion >
<apex:inputField value="{!Contact.LeadSource}" >
<apex:actionSupport event="onChange" reRender="ajaxrequest" />
</apex:inputField>
</apex:actionRegion>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
<apex:outputPanel id="ajaxrequest">
<apex:pageBlockSection rendered="{!Contact.LeadSource=='Web'}">
<apex:inputField value="{!Contact.Description}"/>
</apex:pageBlockSection>
<apex:pageBlockSection rendered="{!Contact.LeadSource=='Phone Inquiry'}">
<apex:inputField value="{!Contact.Phone}"/>
</apex:pageBlockSection>
</apex:outputPanel>
</apex:pageBlock>
</apex:form>
</apex:page>
I have wrote a vf page which is used to display input fields based on LeadSource. If LeadSource == 'web' then it should dispaly Description. But below code is not working..
Help me regarding this. Thank You
<apex:page standardController="Contact">
<apex:form >
<apex:pageBlock title="Enter Contact Information">
<apex:pageBlockButtons >
<apex:commandButton value="Save" action="{!Save}" />
</apex:pageBlockButtons>
<apex:pageBlockSection columns="1">
<apex:inputField value="{!Contact.LastName}" />
<apex:pageBlockSectionItem >
<apex:outputLabel value="Lead Source"/>
<apex:actionRegion >
<apex:inputField value="{!Contact.LeadSource}" >
<apex:actionSupport event="onChange" reRender="ajaxrequest" />
</apex:inputField>
</apex:actionRegion>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
<apex:outputPanel id="ajaxrequest">
<apex:pageBlockSection rendered="{!Contact.LeadSource=='Web'}">
<apex:inputField value="{!Contact.Description}"/>
</apex:pageBlockSection>
<apex:pageBlockSection rendered="{!Contact.LeadSource=='Phone Inquiry'}">
<apex:inputField value="{!Contact.Phone}"/>
</apex:pageBlockSection>
</apex:outputPanel>
</apex:pageBlock>
</apex:form>
</apex:page>
Just change this
<apex:actionSupport event="onchange" reRender="ajaxrequest" />
event as "onChange" doesn't work but if you keep it to "onchange", you should be able to make it work. Worked for me always!
Hope this helps :)
All Answers
Just change this
<apex:actionSupport event="onchange" reRender="ajaxrequest" />
event as "onChange" doesn't work but if you keep it to "onchange", you should be able to make it work. Worked for me always!
Hope this helps :)
You should give Id of the PageBlockSection where you have given the rendered Condition.
I think that will work.
Please reply on this post.