Results 1 to 10 of 10

Thread: Facelets sf:ajaxEvent renderFragments... I'm missing something..

  1. #1
    Join Date
    Jul 2008
    Location
    Medellín, Colombia
    Posts
    135

    Default Facelets sf:ajaxEvent renderFragments... I'm missing something..

    Hi everybody,

    I'm still trying to change to facelets (from jsp) but now I have a problem with the ajax functionality, I'trying to do 3 dependent lists (country, state, city)
    in ajax, so far I see that the change is made in the flow (the variable take the value that the ajax fired action give it to it) but even using render

    <render fragments="hotels:departamentosFragment" />

    nothing change on the web page.

    here's the code:

    the ajax event trigger

    Code:
    <sf:ajaxEvent action="clickBoton"
    							event="onchange">
    							<h:selectOneMenu id="listPaises" styleClass="textfield"
    								value="#{flowScope.pais}">
    								<f:selectItem itemLabel="#{messages['list.seleccione']}" />
    								<f:selectItems value="#{flowScope.paises}" />
    							</h:selectOneMenu>
    						</sf:ajaxEvent>

    the transition on the flow

    Code:
    		<transition on="clickBoton">
    				<set name="flowScope.title" value="'Changed with Ajax'"></set> <!-- new value -->
    			<render fragments="hotels:departamentosFragment" />
    		</transition>
    Facelet
    Code:
    	<ui:define name="content">
    		<h:form id="hotels">
    ....
    ....
    
    <ui:fragment id="departamentosFragment"   >
    												
    						<h:outputText value="#{flashScope.title}"/> 
    ....
    ..
    
    </ui:fragment>
    All the configuration is just fine since i'm working on an swf example (swf-booking-faces).


    What am I missing, please a little help.


    Regards.
    Last edited by m4rkuz; Oct 1st, 2009 at 02:48 PM.

  2. #2
    Join Date
    Jul 2008
    Location
    Frankfurt, Germany
    Posts
    16

    Default

    Appears an error in the firebug console? Appear your changes when you refresh the hole site?

    You can try this:

    Code:
    <ui:fragment id="departamentosFragment">
      <div id="someId">
        <h:outputText value="#{flashScope.title}"/>
        ...
      </div>
    </ui:fragment>
    Explanation: http://forum.springframework.org/showthread.php?t=52721

  3. #3
    Join Date
    Jul 2008
    Location
    Medellín, Colombia
    Posts
    135

    Default

    (Review the first post I've edited it)

    beany thanks for you're input, but sadly I'm still having the same problem...


    you'll see when I change the selected item in the selectOneMenu I can see in the debug console how the value change, but I can not see any re-rendering in my page, off course if I reload the page I see the changes, but that's not what I want, I'm missing the re-render part...

    any other input?
    Last edited by m4rkuz; Oct 1st, 2009 at 02:48 PM.

  4. #4
    Join Date
    Jul 2008
    Location
    Hamburg, Germany
    Posts
    37

    Default

    which debug console do you mean?

    although this will not resolve your problem i would suggest to use the onclick event because in IE the onchange event is only triggered when the formular element looses its focus. and spring-js still has some problems with ajaxEvent and the onclick-event because it stops the event (Jira SWF-801)

  5. #5
    Join Date
    Sep 2009
    Posts
    26

    Default

    i have exactly the same problem under facelet ... is it a bug???

  6. #6
    Join Date
    Jul 2008
    Location
    Medellín, Colombia
    Posts
    135

    Default

    Yes it´s a bug ... it´s called Internet Explorer (any version that is... !! )

    make sure you have a <div id="someId"> </div> around your <ui:fragment...

    is that is the case then, I suggest you try the onclick event but adding processIds="form:inputId" in the sf:ajaxEvent ....

    let me know if it works for you...

    greets

  7. #7
    Join Date
    Nov 2008
    Posts
    742

    Default

    When using JSF and Facelets, I found this only worked when the IDs of the fragments I was rendering were IDs of actual JSF components. See if replacing your <ui:fragment> tag with some regular JSF tag will do the trick.

  8. #8
    Join Date
    Sep 2009
    Posts
    26

    Default

    I still can't get it work....
    I'm using firefox, my ajax event is fired, but my fragment is not rendering...
    And i have no error message...
    Can someone post a working basic exemple Ajax event with render using <h:selectOneMenu> and facelets?

    Thanks

  9. #9
    Join Date
    Sep 2009
    Posts
    26

    Default

    ok, it's now working.... seems like i cant use <evaluate expression> before the <render fragments="..."> tag in the webflow file... really weird
    I also had to use a JSF component like <h:outputLabel value="#{someValue}"/> instead of #{someValue}
    Last edited by herve; Oct 1st, 2009 at 07:18 PM.

  10. #10
    Join Date
    Nov 2008
    Posts
    742

    Default

    Ah, that makes sense. I didn't think about that one since your example used a set action instead of evaluate.

    If there's the possibility for your evaluate to return false or throw an exception, the remaining actions (including your render action) will not be executed. In these cases, you'll always want your render action to be the first one in your transition.

Posting Permissions

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