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
Romeo Ngo 1Romeo Ngo 1 

Apex:CommandButton with ReRender a section: current data in the section is lost

I'm experiencing an issue with commandButton and reRender a section.

We have a list of contacts on the pages and a button to add a new blank contact lookup.  (Steps below)
1.  We add 1 blank contact (a input with the contact search) -- <apex:inputField value="{!contact}"/>
2.  Then I search for the contact for this 1st contact input.
3.  Then click an action (simply add a new contact to a List<Contact> on the page) and then reload that contact list section.
4.  The section is refreshed but the input in #2 is lost.

When I don't do reRender section (refresh the whole page), the input in Step #2 is NOT Lost.

I wonder if there anyway to prevent this.

Thanks.
 
Romeo Ngo 1Romeo Ngo 1
Anyone experienced with this before?
Romeo Ngo 1Romeo Ngo 1
Ok found the problem for people who have this issue in the future.

I need to include the refresh section within the ActionRegion that include the button that trigger the post back.  The reason for this is so the current data can be posted back as well so you don't lose it.