Q:

commandLink to update oncomplete's text before launching oncomplete

I've got a tricky problem. I need to submit a form and update a map (with one click) with the data from the form, that just has been submitted. Now, what it does is: submitted data is up to date but the map's data is from the last call. The idea is for the update to be called before oncomplete somehow.
Here is the code:
<h:panelGroup layout="block" id="addressBlock" >            
        <h:panelGrid columns="2" columnClasses="geolabels, geoinputs" id="addressInputs">
            Straße <h:inputText styleClass="sidebar-input" value="#{search.searchContainer.geoCodeSearch.adresse}" /> 
            Plz <h:inputText styleClass="sidebar-input" value="#{search.searchContainer.geoCodeSearch.plz}" />
            Ort <h:inputText styleClass="sidebar-input" value="#{search.searchContainer.geoCodeSearch.ort}" />
        </h:panelGrid>      
        <p:commandLink styleClass="btn" value="#{messages['global.search']}" process="@this, addressInputs"
            action="#{search.searchContainer.geoCodeSearch.geoCode()}" update="geoCodeResult, addressBlock"
            oncomplete="updateMap('#{dataForMap}', true);" />   
</h:panelGroup>

A:

That is a normal behavior, the #{dataForMap} is processed at render time, not at update time.
This should do the trick :
<p:commandLink styleClass="btn" value="#{messages['global.search']}" process="@this, addressInputs" action="#{search.searchContainer.geoCodeSearch.geoCode()}" update="geoCodeResult, addressBlock, dataForMap" /> 

<h:panelGroup id="dataForMap">
    <h:panelGroup rendered="#{dataForMap ne null}">
        <script>
            updateMap('#{dataForMap}', true);
        </script>
    </h:panelGroup>
</h:panelGroup>

The #{dataForMap} will be updated and the script executed after the DOM is updated.

