today i'm having some issues with actionFunction and actionSupport visualforce tag.
This is my example page:
<apex:page controller="TestLookupActionFunctionCtrl">
<apex:form id="myform">
<apex:pageBlock>
<!-- Test with ActionSuport - NOT WORKING! -->
<apex:pageBlockSection title="Section 1">
<apex:inputField value="{!c.Birthdate}">
<apex:actionSupport event="onblur" action="{!test}" reRender="out" />
</apex:inputField>
<apex:outputPanel id="out" rendered="{!show}">
<apex:inputField value="{!c.Department}" />
</apex:outputPanel>
</apex:pageBlockSection>
<!-- Test with ActionFunction - NOT WORKING -->
<apex:actionFunction name="myAction" action="{!test2}" reRender="out2" />
<apex:pageBlockSection title="Section 2">
<apex:inputField value="{!c2.Birthdate}" onblur="myAction()" />
<apex:outputPanel id="out2" rendered="{!show2}">
<apex:inputField value="{!c2.Department}" />
</apex:outputPanel>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
As you can see i have two pageBlockSection, each of them with an inputField to insert. I want that when user insert a value, raise the action specified by actionsupport/actionFunction tag.
This is the controller:
public class TestLookupActionFunctionCtrl {
public Contact c {get;set;}
public Contact c2 {get;set;}
public boolean show {get;set;}
public boolean show2 {get;set;}
public TestLookupActionFunctionCtrl() {
c = new Contact();
c2 = new Contact();
show = false;
show2 = false;
}
public PageReference test() {
show = true;
return null;
}
public PageReference test2() {
show2 = true;
return null;
}
}
Believe it or not, i'm not able to rerender correctly those two outputPanel :(
Could you help me please? I red on internet and the only thing that i was able to find was that both the actionFunction and actionSupport work correctly with outputPanel and both must be outside the outputPanel that are going to rerender.
Thxs guys ;)