Problem with menu onchange action
dantevaze Jul 10, 2007 2:19 PMHello Everyone.
I am working on a JSF application,with Facelets,Tomahawk and Ajax4jsf. Im having trouble with the h:selectOneMenu. In my xhtml file, I have two selectOneMenu elements,and one h:inputText element. All the three of them contribute to display a name,in another h:inputText. The two selectOneMenu are not working,but the inputText is. In the resulting inputText,where the combination of the three must appear,only the changes in the last inputText are viewed.
Here is the code:
<ui:define name="body"> <a4j:region selfRendered="true"> <h:form> <h:outputText value="#{msg.projectType}"/> <h:selectOneMenu value="#{tcprojBean.projectType}"> <f:selectItems value="#{tcprojBean.projtypes}"/> <a4j:support event="onchange" action="#{tcprojBean.methodBind}" ajaxSingle="true"reRender="repeater"/> </h:selectOneMenu> <h:outputText value="#{msg.customerName}"/> <h:selectOneMenu value="#{tcprojBean.customer}"> <f:selectItems value="#{tcprojBean.customers}"/> <a4j:support event="onchange" action="#{tcprojBean.methodBind}" ajaxSingle="true" reRender="repeater" /> </h:selectOneMenu> <h:outputText value="#{msg.projectName}"/> <h:inputText value="#{tcprojBean.iname}"> <a4j:support event="onkeyup" ajaxSingle="true" reRender="repeater" /> </h:inputText> <h:outputText value="#{msg.projectFName}"/> <h:inputText id="repeater" disabled="true" value="#{tcprojBean.trigram} #{tcprojBean.type} #{tcprojBean.iname}"/> <h:commandButton action="#{tcprojBean.createTcProject}" value="#{msg.createProject}" title="Submit"></h:commandButton> </h:panelGrid> </h:form> </a4j:region> </ui:define>
And the backing bean method is defined as:
public void methodBind(){
System.out.println("test");
//this.type = "-"+ptype[this.getProjectType()]+"-";
//this.trigram = this.getCustomer().getTrigram();
}
just to test if the method is fired with the event. The bean is defined in the faces-config.xml with a session scope. Just to try, i put in another page an
h:SelectOneMenu element alone with a h:inputText,and there it works. I even put a System.out inside the Backing Bean "projecType" property setter,and that is working too. I can´t tell why this is not working. I´d thank you lots for your help.