Results 1 to 4 of 4

Thread: multiple 'evaluate expression'

Hybrid View

  1. #1
    Join Date
    Mar 2007
    Posts
    113

    Default 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. #2
    Join Date
    Mar 2007
    Posts
    113

    Default

    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

  3. #3
    Join Date
    Nov 2008
    Posts
    742

    Default

    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.

  4. #4
    Join Date
    Mar 2007
    Posts
    113

    Default

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

    appreciate the the help!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •