2 Replies Latest reply on Jan 18, 2011 9:53 AM by Earnest Dyke

    ValueChangeListener not working

    Olalekan Ogunleye Newbie
      Hi all,

      Can someone please help me and tell me what I am doing wrong? OK, this is what I want to do. I have a form which contains combox (<h:selectOneMenu>) only with some options. And so I want to make sure that when a user selects one of the options in the combox box a form should be rendered on the same page. I am using panel. I have tried to put some words like 11111, 22222, 3333 in the place where I want to display my other form and this words are displayed. I have also used ui:include but I get WARNING [renderkit] 'for' attribute cannot be null instead of displaying the form. Also, I have tried to do it from the code but its not working out. Can someone help me out please.

      Below is my code and backing bean

      <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
      <ui:composition xmlns="http://www.w3.org/1999/xhtml"

      <ui:define name="body">
           <a4j:keepAlive beanName="valueChangeManager"></a4j:keepAlive>
          <h:form id="serviceForm">
                      <f:facet name="header">Configure Service for New Subscriber</f:facet>
                      <h:panelGrid columns="1">
                      <s:decorate id="nameDecoration" template="layout/edit.xhtml">
                        <ui:define name="label">Select Service:</ui:define>
                        <h:selectOneMenu value="#{valueChangeManager.state}" valueChangeListener="#{valueChangeManager.valueChanges}">
                              <f:selectItem itemValue="" />
                           <f:selectItem itemValue="keyword" />
                             <f:selectItem itemValue="sms" />
                              <f:selectItem itemValue="c3to" />
                              <a4j:support event="onchange" ajaxSingle="true" reRender="wrap1,wrap2,wrap3"></a4j:support>
                  <rich:panel id="wrap1">
                  <rich:panel rendered="#{valueChangeManager.state eq 'keyword'}">
                  <ui:include src="/serviceKeyword.xhtml"/>
                  <rich:panel id="wrap2">
                  <rich:panel rendered="#{valueChangeManager.state eq 'sms'}">
                  <rich:panel id="wrap3">
                  <rich:panel rendered="#{valueChangeManager.state eq 'c3to'}">



      package valueChangeManager

      import java.io.Serializable;
      import org.jboss.seam.annotations.Name;
      import javax.faces.event.ValueChangeEvent;
      import javax.faces.context.FacesContext;

      public class ValueChangedBean implements Serializable, ValueChanged {
           private String state="";
           private static final long serialVersionUID = 1L;
           public String valueChanges(ValueChangeEvent e) {
                if (e.getNewValue().equals("keyword")) {
                }else if (e.getNewValue().equals("sms")) {
                     state = "sms";
                }else if (e.getNewValue().equals("c3t0")) {
                return state;
           public String getState() {
                return state;
           public void setState(String state) {
                this.state = state;

           public String keywordSelected() {
                return "/serviceKeyword.xhtml";

           public String smsSelected() {
                return "/serviceSms.xhtml";

           public String c3toSelected() {
                return "/servicec3to.xhtml";