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
SFDC Developer ASFDC Developer A 

Does "state" of variables behaves differently in partial page refresh vs full page refresh ?

Hi Guys,

In visual force page, when user clicks on "Save" button ( that is command button with action function ), we are first validating input fields and then creating / deleting records using those fields.

Those fields are declared as "public getter /setter" ( i.e class variables with state ). Again there are many fields which are in "inner class" which act as wrapper class and that wrapper class is defined via class variable on outer class.

In our current implementation, when we encounter validation error, we are refreshing entire page.

Now, I wanted to change the behavior from "refreshing entire page" to "only refresh error MSG section" ( i.e partial refresh ).

Will that create any issues with regards to "state" of the variables ?

Will we face any issue regarding messed up state for member variables ( getter / setter )?

Please give your input.

Thanks !!
bob_buzzardbob_buzzard
No, a partial refresh via a rerender doesn't affect the postback - that will still send the entire form back and update the viewstate.  If you want to, you can restrict to submitting part of the form only via the <apex:actionRegion /> tag.

Only the section that you are rerendering will be udpated however, so it is possible that the state will be different in the controller to a section on the page that hasn't been refreshed.