2 Replies Latest reply on Aug 3, 2010 3:09 AM by Flavio Palumbo

    try to enable ajax in a form

    Flavio Palumbo Newbie

      Hi all,

      i'm trying to give ajax behavior to a simple form.

      Following the example on http://livedemo.exadel.com/richfaces-demo/richfaces/form.jsf i added 2 lines of code to an existing form, but i got 2 results :

      - the form behaves in the standard way (no ajax)

      - a little rectangle box is painted under my panel

      I run under tomcat 6, jdk1.6, richFaces 3.3.3.

      Can somebody help me ?

      Flavio

       

       

      Here the code :

       

      <html xmlns="http://www.w3.org/1999/xhtml"
            xmlns:h="http://java.sun.com/jsf/html"
            xmlns:ui="http://java.sun.com/jsf/facelets"
            xmlns:a4j="http://richfaces.org/a4j"
            xmlns:rich="http://richfaces.org/rich">
          <ui:composition>
              <rich:panel  style="width:300px">
                  <a4j:form ajaxSubmit="true" reRender="pass, mess">                          <-- added to enable ajax
                      <h:panelGrid columns="2" border="0" cellspacing="5">
                          <h:outputText value="#{mess.labelUser}" style="padding-right:5px"/>
                          <h:inputText id="usr" value="#{login.username}"   />

                          <h:outputText value="#{mess.labelPass}" style="padding-right:5px"/>
                          <h:inputSecret id="pass" value="#{login.password}"/>
                          <br/>
                          <h:commandButton value="login" action="#{login.doLogin}" styleClass="login-button"/>
                      </h:panelGrid>
                      <rich:messages  id="mess" style="color:red"/>
                  </a4j:form>                                                                                       <-- added to enable ajax
              </rich:panel>
          </ui:composition>>
      </html>