a4j:commandButton actionMethod not invoked when in conditionally rich:popupPanel
andreaswussler Jul 1, 2013 7:15 AMHi,
I have a problem with a a4j:commandButton which doesnt fire the action method. The button is in a conditionally rendered rich:popupPanel.
Here is a simple sample:
test.xhtml site:
<?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:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
xmlns:rich="http://richfaces.org/rich" xmlns:a4j="http://richfaces.org/a4j">
<h:head>
</h:head>
<h:body>
<h:form id="testForm">
<a4j:commandLink id="addTask_link" value="openTestPopupPanel" render="@form"><!--this button is working-->
<f:setPropertyActionListener target="#{renderTestMb.rendered}" value="#{true}" />
</a4j:commandLink>
<h:panelGroup id="testPopupContainer">
<rich:popupPanel show="true" id="testPopup" autosized="true" domElementAttachment="form" rendered="#{renderTestMb.rendered}">
<f:facet name="controls">
<h:outputLink value="#" onclick="#{rich:component('testPopup')}.hide(); return false;">X</h:outputLink>
</f:facet>
<rich:messages />
<h:messages />
<!-- Input: Kundennummer -->
<h:outputLabel value="input" for="inputStartBpelTask_kundennummer" />
<h:inputText value="#{renderTestMb.input}" id="inputStartBpelTask_kundennummer" />
<br />
<a4j:commandButton value="test action button" action="#{renderTestMb.ajaxAction()}" execute="@form" render="@none"
id="testActionButton" /><!-- this button SHOULD FIRE the action method-->
<a4j:log></a4j:log><!--No error to see-->
</rich:popupPanel>
</h:panelGroup>
</h:form>
</h:body>
</html>
Java Bean:
package de.suedleasing.elease.web.test;
import javax.enterprise.context.RequestScoped;
import javax.inject.Named;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@Named
@RequestScoped
public class RenderTestMb {
private static final Log log = LogFactory.getLog(RenderTestMb.class);
private boolean rendered;
private Long input;
public void ajaxAction(){
log.info("test");
}
public boolean isRendered() {
return rendered;
}
public void setRendered(boolean rendered) {
this.rendered = rendered;
}
public Long getInput() {
return input;
}
public void setInput(Long input) {
this.input = input;
}
}
Regards
Andreas