i am using action function as i need values of form in my controller after an on change event is fired.but there are some required fields also.when i change some value in dropdown action function is called and it gives the required validation error on other required fields .when i fill them and again onchange event is fired ,i get the changed value in backend.but i want that it should avoid the required validation error on other fields for that i use immediate="true " with action function but now it does not gives required error but in my controller method i did not get values.whats the reason for that .how can i overcome this?

<apex:actionRegion >
    <!-- Displaying Personal Data section -->
    <apex:repeat value="{!contactInformation}" var="contact" rendered="{!contactInformation.size>0}">
        <apex:repeat value="{!ContactFields}" var="contactInfo">
            <apex:pageBlockSection columns="2" title="Contact Information">
                <apex:repeat value="{!Fields}" var="current">
                    <apex:inputField styleClass="country" label="Country"  value="{!contact[current.fieldPath]}" onChange="dynamicConditions();" required="{!OR(current.required, current.dbrequired)}"/>  
    <apex:commandButton title="Save" value="Save" action="{!save}"/>
    <apex:actionFunction name="dynamicConditions" action="{!dynamicConditions}"/>
  • Your action function is outside of action region. Did you try bringing in that?
    – doga
    Feb 11, 2013 at 9:40

2 Answers 2


Buried in the order of execution for visualforce postback requests section of the docs is this nugget of information:

During a postback request, the view state is decoded and used as the basis for updating the values on the page. Note: A component with the immediate attribute set to true bypasses this phase of the request. In other words, the action executes, but no validation is performed on the inputs and no data changes on the page.

So if you use immediate, it doesn't just skip the validation, it also discards the user input.

I think your problem should be solved by moving the actionFunction inside the actionregion - otherwise it will be posting back the entire form, including any required fields, rather than just your selected components.


You can also try using another approach in which all the necessary parameters are passed as apex param.

<apex:actionFunction name="myFunc" action="{!dynamicConditions}">
        <apex:param name="param1" value=""/>

To call apex action method use following javascript

myFunc("myvalue1", "myvalue2", ...);

Inside apex action method use following code to get value of param

String param1 = ApexPages.currentPage().getParameters().get('param1');

You must log in to answer this question.

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