1 Reply Latest reply on Apr 10, 2012 5:01 PM by Alex Perstinski

    Ajax form render  RF 4.2 problem

    Nikolai Alexeev Newbie

      Hi, i'm trying to move our project to RF 4.2 (from RF 3.3.3 and JSF 1.2) and one of the problems i've faced is incorrect work of render attribute of a4j components: for some reason they don't render forms correctly. When i render form with native f:ajax form is rerendered correctly and every component on that form works as it should but when i do the same with any a4j component (a4j:commandButton, a4j:commandLink, a4j:ajax or a4j:jsFunction) form is broken and if i click say on button inside that rerendered form my view bean is recreated or in some other cases first click doesn't work and only second does. It's very frustrating because not everywhere i can replace a4j components with f:ajax as it doesn't have a lot of attributes like oncomplete, onsubmit and others, and a4j:jsFunction doesn't have any analogue at all. Is there any way of fixing it?

        • 1. Re: Ajax form render  RF 4.2 problem
          Alex Perstinski Newbie

          The problem is that javax.faces.ViewState is not rendered when you render another form.
          In jsf.js internal javascript function doUpdate(element, context) expects that context.render has a list of the Ids with space as delimiter. And when you use f:ajax it is there.
          But if you take a look inside richfaces.js you will see following in richfaces.ajax = function(source, event, options):
          parameters.render = "@component";


          so if you use a4j:commandButton than context.render="@component" - JSF just skips that...

           


          Possible workaround will be to render a part of the form, not whole one,
          or modify jsf.js to check if context.render==="@component" use list of all form ids in your document separated by space instead.

           

          P.S. Richfaces 4.2.1.CR1, Mojarra 2.1.7