4 Replies Latest reply on Mar 19, 2009 4:20 AM by darmstadter

    how to use h:form rightly

      it's bad to have more than one form on a page? e.g in my page there is rich:tree at the left, and sdt at the right. The both are wired by facelets composition, and are inserted into a page. My question is that, it is better, every component wired by h:form or both wired by a h:form. i.e, that
      tree.html

      <ui:composition>
      <h:form>
      <rich:tree/>
      </h:form>
      </ui:composition>
      


      dataTable.html
      <ui:composition>
      <h:form>
      <rich:dataTable/>(include a4j:command )
      </h:form>
      </ui:composition>
      


      page.xhtml
      <html>
      <ui:insert>tree.xhtml</ui:insert>
      <ui:insert>dataTable.xhtml</ui:insert>
      </html>
      


      or in tree.xhtml and dataTable.xhtml without h:form, only with one h:form in page.xhtml
      <html>
      <h:form>
      <ui:insert>tree.xhtml</ui:insert>
      <ui:insert>dataTable.xhtml</ui:insert>
      </h:form>
      </html>
      


        • 1. Re: how to use h:form rightly

          another question, how can the h:form be reset as same as the normal html form. In wizard of richfaces demo, if there is a cancel button, how clear the inputs: name etc?

          • 2. Re: how to use h:form rightly
            daedlus

            use this to include pages <ui:include src="test.xhtml"/>
            and in the included page i.e test.xhtml do not have forms is OK.
            remember that nesting of forms is not good..with that in mind decide about adding forms

            • 3. Re: how to use h:form rightly
              nbelaevski

              Hello,

              Form defines part of the page that will be submitted to the server when request is done (AJAX requests have means to define processed components, but still the whole form is submitted). So you can use forms whatever you like.

              Note that view state field is being rendered for each form, so that increasing number of forms for the case of client-side state saving can significantly increase response size.

              • 4. Re: how to use h:form rightly

                thanks their replies. I use the server-side state saving. I throught that, if too many components included in a form the request size will be increased on submit. With the separate form can reduce.