2 Replies Latest reply on Sep 26, 2007 2:22 PM by doballve

    SimpleTogglePanel + Seam in 3.1.0

    doballve Newbie

      I'm using multiple SimpleTogglePanel (switchType=client) inside a form with jars built from svn tag 3.1.0. When the page is rendered for the first time all is fine, 1 form, many panels, but if the page gets redisplayed (for instance submit + validation failed) the panels are treated as AjaxViewRoots.. is it intended?

      In my case, the page cannot be redisplayed because one of the panels contained a suggestion box and that complains it is not inside a form (on redisplay only!) and if I remove that panel i get the page to display, but checking the rendered HTML source shows multiple forms, one for each panel at least.. submits are all broken then.

      Any insights?

      Thanks,
      Diego

        • 1. Re: SimpleTogglePanel + Seam in 3.1.0
          Ilya Shaikovsky Master

          paste please code snippet for your case.

          • 2. Re: SimpleTogglePanel + Seam in 3.1.0
            doballve Newbie

            I got the cause a bit more refined while preparing you a snippet: it only happens if I use my custom TagHandler inside the form. I can move it to immediately before the form and I think it works the same for me, so up to you to decide if it is a bug or just wrong TagHandler usage.

            Here is the XHTML:

            <h:form enctype="multipart/form-data">
             <dc:formMode value="EDITABLE" var="dcFormMode">
            
             <rich:simpleTogglePanel switchType="client" label="Panel1">
             <h:inputText id="v1" value="#{panelTest.value1}" required="true"/>
             <h:message for="v1"/>
             </rich:simpleTogglePanel>
            
             <rich:simpleTogglePanel switchType="client" label="Panel2">
             <h:inputText id="v2" value="#{panelTest.value2}" required="true"/>
             <h:message for="v2"/>
             </rich:simpleTogglePanel>
            
             <h:messages/>
             <h:commandButton value="Submit"/>
            
             </dc:formMode>
             </h:form>
            


            And here the relevant part of the TagHandler:
            public void apply(FaceletContext ctx, UIComponent component)
            throws IOException, FacesException, FaceletException, ELException {
             ...
             VariableMapper orig = ctx.getVariableMapper();
             try {
             // use a wrapper to redefine our value
             VariableMapperWrapper map = new VariableMapperWrapper(orig);
             ValueExpression modeVE = ctx.getExpressionFactory()
             .createValueExpression(uiFormMode, UIFormMode.class);
             map.setVariable(var.getValue(), modeVE);
             ctx.setVariableMapper(map);
            
             this.nextHandler.apply(ctx, component);
            
             } finally {
             ctx.setVariableMapper(orig);
             }
            }
            


            Thanks for your time.
            Diego