function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
asadimasadim 

Rerender tries to validate fields -it shouldn't

I have a simple pageBlock with a required field and a button in it. The button calls a method from the controller and then rerenders the pageBlock. The issue is, when the rerender happens if the field is blank I get an error (Error: You must enter a value) and the pageBlock doesn't get rerendered. I don't want any validation at this stage; I just want the PB to rerender that's all.

 

Any ideas on how to do that would be nice.

Thanks!
Best Answer chosen by Admin (Salesforce Developers) 
CapWCapW

On the button, make sure immediate="true" attribute is included in the command button component. 

 

ie.

 

<apex:commandButton action="{!somemethod}" value="doSomething" styleClass="btn" immediate="true"/>

 

 This should skip all validation and let you have the pageBlock be rerendered.

 

Cheers,

 

W

 

All Answers

CapWCapW

On the button, make sure immediate="true" attribute is included in the command button component. 

 

ie.

 

<apex:commandButton action="{!somemethod}" value="doSomething" styleClass="btn" immediate="true"/>

 

 This should skip all validation and let you have the pageBlock be rerendered.

 

Cheers,

 

W

 

This was selected as the best answer
Rajesh ShahRajesh Shah

Another way to not go through the validation is to embed the button in actionRegion tags. If you use actionRegion, only the data changes made inside the actionRegion tags will be submitted to the controller.

Message Edited by Rajesh Shah on 01-27-2010 05:19 PM
asadimasadim
Totally forgot about the immediate attrib! Thanks both.