+ Start a Discussion

How can I disable page validation when I use actionSupport to rerender selected fields ?

We have the following visualforce page for new Lead that uses an ActionSupport tag. The functionality is to rerender the Street name field to auto-populate the information based on the postal code information entered. The issue is that the page does a validation before submitting the information to server when user enters the postal code; and the auto-population of street name fails. But if all the madatory information is entered in the VF lead page like (Lead name,Company,Street Number,etc) before the request is submittied with the postal code, then it works fine and populates the rest of the address.
We also tried using the "immediate"  attribute of actionSupport tag byt setting it to false like this, but in vain.
Please find the attached VF page and Controller. This is the snippet of VF code that is having issues:
            <apex:inputField value="{!lead.Postal_Code__c}" required="true" id="postal_code">           
                 <apex:actionSupport event="onblur"   action="{!addressAutoPop}"  reRender="sname" immediate="true" />
             <apex:inputField id="snumber" value="{!lead.Street_Number__c}" required="true"/><b/>
                <apex:inputField id="sname" value="{!lead.Street_Name__c}" />           

Appreciate all your valuable feedbacks.

Thanks and regards
I think you mean setting the immediate attribute to "true", which I would think would work.

You can also use the actionRegion tag to control which portion of your form gets submitted.


Thanks for the response. I have tried using actionRegion tag too. The issue is if any of the field in that page section is mandatory(i.e required="true") within the actionRegion, then that fields gets validated; but the fields from the other sections are not validated by this approach. Is there any way to avoid the validation of fields within the page section during rerender?

Thanks and regards

Arun BalaArun Bala
Hi Arasu, Did this ever work for you ?? I also face the same issue now. Pls let me know your thoughts !

I know this is a bit dated, but I just ran into the same issue and was able to solve it with actionRegion.  Try the following : 



<apex:pageblocksectionitem><apex:outputLabel value= “Postal Code” for=”postal_code”><apex:actionRegion><apex:inputField value=”{!lead.Postal_Code__c}” required=true id=”postal_code”><apex:actionSupport event= ”onblur” action= ”{!addressAutoPop}” reRender=sname”/></apex:inputField></apex:actionRegion></apex:pageblocksectionitem>


The field that has the actionSupport will probably still throw a validation error, I just didnt have it rerender the <apex:pageMessages> and it worked fine. 






 For me its working. Thank you sooooooooooooooo much 

kaustubh priy jaiswalkaustubh priy jaiswal
i am facing the same issue I have a Ui form on lead standard controller  and there is a selection section if any of the value get selected it render a new section but  , this functionality  does not work until I fill requre fields  ,  i have also used imidiate atrribute  true but still its  not working suggest  a solution please . thanks in advance .