2

I'm extracting part of a Visualforce page into a component, however there's one piece of functionality that doesn't come across. Here's a simplified apex snippet:

<apex:actionRegion>
    <apex:actionFunction action="{!zipChanged}" name="zipUpdate" rerender="state" />
    <apex:inputField value="{!thing.ZipCode__c}" onchange="zipUpdate();" />
    <apex:inputText id="state" value="{!thing.State__c}" required="true" />
</apex:actionRegion>

This works fine in the Visualforce page, but not the component. The onchange fires, and there's a postback in the logs, but I don't see any debug statements even when I add some to the getters/setters that are being called in the logs (so I assume that's the view state or whatever being processed). Needless to say, zipChanged is not called.

Why is zipChanged not being called?

1
  • In case somebody thinks to ask: Yes, there is a surrounding form tag.
    – ricksmt
    Commented Apr 3, 2015 at 15:39

2 Answers 2

0

Your input Text state is required field & also within actionRegion Hence your method zipChanged will be called only when state is populated & zip is changed.

1
  • 1) You ignore that I said this works on the Visualforce page, 2) State happens to be present in my case, and 3) I've already tried with state outside the actionRegion: same result.
    – ricksmt
    Commented Apr 3, 2015 at 15:39
0

We have the same problems. Actionfunctions and Actionregions are not working properly within components.

Ugly workaround:

Create an actionfunction (in a different form to be sure) that has explicit apex:params and then call it with the param value set explicitly

<apex:actionFunction action="{!zipChanged}" name="zipUpdate" rerender="state" />
    <apex:param value="123" assignTo="{!thing.ZipCode__c}" id="zip" name="zip" />
</apex:actionFunction>
<apex:inputField value="{!thing.ZipCode__c}" onchange="zipUpdate(this.value);" />

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .