0 Replies Latest reply on Jul 17, 2008 2:18 PM by Anthony Mattas

    Can't Get a4j support to work

    Anthony Mattas Newbie

      This is my code, and it is using a session scope bean. The a4j:panels don't render or derender as the selection box is changed.

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      
      <html xmlns="http://www.w3.org/1999/xhtml"
       xmlns:ui="http://java.sun.com/jsf/facelets"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:f="http://java.sun.com/jsf/core"
       xmlns:a4j="http://richfaces.org/a4j"
       xmlns:rich="http://richfaces.org/rich"
       xmlns:fn="http://java.sun.com/jsp/jstl/functions" xml:lang="en"
       lang="en">
       <ui:composition template="/templates/template.xhtml">
       <head>
       <title>My XHTML Page</title>
       <meta http-equiv="keywords" content="enter,your,keywords,here" />
       <meta http-equiv="description"
       content="A short description of this page." />
       <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
      
       <!--<link rel="stylesheet" type="text/css" href="styles.css">-->
       </head>
       <body>
      
      
      
      
       <ui:define name="title">
       Stryker Custom Implants : Create New User
       </ui:define>
       <ui:define name="breadcrumb">
       <h:form>
       <h:commandLink action="home">Home</h:commandLink>
       <span>Register</span>
       </h:form>
       </ui:define>
       <ui:define name="body">
       <h:form id="adduser">
      
      
       <h:panelGrid columns="3">
      
       <h:outputText value="E-Mail:" />
       <h:inputText id="email" value="#{UserInfo.username}"
       maxlength="75" validator="#{UserInfo.validateEmail}"
       required="true" requiredMessage="Field required."></h:inputText>
       <h:message for="email" styleClass="error" />
      
       <h:outputText value="First Name:" />
       <h:inputText id="firstname" value="#{UserInfo.firstname}"
       maxlength="50" validator="#{WebValidators.validateShort}"
       required="true" requiredMessage="Field required.">
       </h:inputText>
       <h:message for="firstname" styleClass="error" />
      
       <h:outputText value="Last Name:" />
       <h:inputText id="lastname" value="#{Register.lastname}"
       maxlength="50" validator="#{WebValidators.validateShort}"
       required="true" requiredMessage="Field required."></h:inputText>
       <h:message for="lastname" styleClass="error" />
      
       <h:outputText value="Title:" />
       <h:selectOneMenu id="title" value="#{Register.title}"
       validator="#{WebValidators.validateShort}">
       <f:selectItem itemLabel="" itemValue="" />
       <f:selectItem itemLabel="DDS" itemValue="DDS" />
       <f:selectItem itemLabel="DMD" itemValue="DMD" />
       <f:selectItem itemLabel="FACS" itemValue="FACS" />
       <f:selectItem itemLabel="FRCS(C)" itemValue="FRCS(C)" />
       <f:selectItem itemLabel="MD" itemValue="MD" />
       <f:selectItem itemLabel="MS" itemValue="MS" />
       <f:selectItem itemLabel="PhD" itemValue="PhD" />
       </h:selectOneMenu>
       <h:message for="title" styleClass="error" />
      
       <h:outputText value="Phone:" />
       <h:panelGrid columns="4">
       <h:inputText id="phone" value="#{Register.phone}" size="10"
       maxlength="10" required="true" requiredMessage="Field required."
       validator="#{WebValidators.validatePhone}"></h:inputText>
       <h:outputText value="ext." />
       <h:inputText id="extension" value="#{Register.extension}"
       size="9" maxlength="9"
       validator="#{WebValidators.validatePhone}"></h:inputText>
       <h:message for="phone" styleClass="error" />
       </h:panelGrid>
       <h:message for="extension" styleClass="error" />
      
       <h:outputText value="Fax:" />
       <h:inputText id="fax" value="#{Register.fax}" size="10"
       maxlength="10" validator="#{WebValidators.validatePhone}"></h:inputText>
       <h:message for="fax" styleClass="error" />
      
       <h:outputText value="Type:" />
      
       <h:selectOneMenu id="groupname" value="#{Register.groupname}"
       validator="#{WebValidators.validateShort}">
       <f:selectItem itemLabel="" itemValue="" />
       <f:selectItem itemLabel="Sales" itemValue="sales" />
       <f:selectItem itemLabel="Customer" itemValue="customer" />
       <f:selectItem itemLabel="In House" itemValue="admin" />
       <f:selectItem itemLabel="Manufacturing" itemValue="man" />
       <a4j:support event="onchange" rerender="sales,customer" />
       </h:selectOneMenu>
       <h:message for="title" styleClass="error" />
       </h:panelGrid>
      
       <a4j:outputPanel id="sales"
       rendered="#{fn:containsIgnoreCase(Register.groupname, 'sales')}">
       <h:panelGrid columns="1">
       <h:outputText value="Supervisor:" />
       </h:panelGrid>
       </a4j:outputPanel>
      
       <a4j:outputPanel id="customer"
       rendered="#{fn:containsIgnoreCase(Register.groupname, 'customer')}">
       <h:panelGrid columns="1">
       <h:outputText value="Customer:" />
       <h:outputText value="Supervisor:" />
       </h:panelGrid>
       </a4j:outputPanel>
      
       <h:commandButton id="submit" action="#{Register.add}"
       value="Register" styleClass="button" />
      
       <a4j:log />
       </h:form>
       </ui:define>
       </body>
       </ui:composition>
      </html>