Announcement Announcement Module
Collapse
No announcement yet.
multiple 'evaluate expression' Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • multiple 'evaluate expression'

    hi all...

    I have a sf:ajaxEvent that is invoked 'onchange':

    Code:
    <div class="input">
         <sf:ajaxEvent action="setCityAndPostalCode" event="onchange" processIds="state">
    
    	<h:selectOneMenu
    		id="state"
    		value="#{address.state}">
    		<f:selectItems value="#{backingData.states}"/>
    	</h:selectOneMenu>
         </sf:ajaxEvent>
    </div>
    In my flow I call 2 evaluate expression statements to set the citiesList and postalCode.

    Code:
    <transition on="setCityAndPostalCode">
        	<evaluate expression="addressService.populateCity(address.state)" result="viewScope.citiesList"/>
        	<render fragments="createAddressForm:city"></render>
           <evaluate expression="addressService.populatePostalCode(address.state)" result="address.postalCode"/>
     	<render fragments="createAddressForm:postalCode"></render>
    </transition>
    My citiesList is being populated no problem within the form. But my postalCode is not (it's left blank). Here's my postalCode inputText:

    Code:
    <ui:fragment id="postalCodeFragment">
        <div class="field">
    	<div class="label">Postal Code:</div>
    	<div class="input">
    	   <sf:clientTextValidator required="true">
    		<h:inputText id="postalCode" value="#{address.postalCode}" required="true">
    	        </h:inputText>
    	    </sf:clientTextValidator>
             </div>
         </div>
    </ui:fragment>
    Both the city and postalCode are part of the createAddressForm. Can anyone provide some insight into why my postalCode is not being populated?

    thanks

  • #2
    hi all...

    I changed my flow definition to use a comma separated list of the fragments (based on reading from the docs). But, in doing so, neither my citiesList nor the postalCode are set then...

    Code:
    <transition on="setCityAndPostalCode">
        	<evaluate expression="addressService.populateCity(address.state)" result="viewScope.citiesList"/>
        	<evaluate expression="addressService.populatePostalCode(address.state)" result="address.postalCode"/>
        	<render fragments="createAddressForm:city,address:postalCode"></render>
    </transition>
    No luck so far...ideas welcome...

    thanks

    Comment


    • #3
      Recall that if an evaluate action results in false (maybe null too? I forget...), it will cancel the transition and the following actions. I would try using a set action instead:

      Code:
      <set name="address.postalCode" value="addressService.populatePostalCode(address.state)"/>
      Also, I find it helpful to put all of my render actions first, that way they'll still work even if an evalute action cancels my transition.

      Comment


      • #4
        thanks. by putting the render before the evaluate stmts it's working great.

        appreciate the the help!

        Comment

        Working...
        X