Passing component value via aj4:actionparam
lenyas66 Jun 2, 2010 6:35 PMI need to add a command button to the screen, which will perform DB delete operation without regard to the data entered on the screen. To avoid validation issues I use immediate attribute for it set to true, but then it doesn't update bean value for the single parameter I need to pass to the delete function. Its value does appear on the screen, but I need to assign it to the backing bean variable.
I thought, I could pass it using a4j:actionparam, but it doesn't seem to be working could somebody tell me, what might be wrong?
Code is below. I need to pass the value of comboBox with id "template" to the command button "deleteTemplate".
XHTML:
< h:panelGrid id="templateParams" columns="8"> <h:outputText value="Templates:" style="font-weight:bold" /> <rich:comboBox id="template" width="160" value="#{qtBeanParam.templateName}" enableManualInput="true" > <f:selectItems id="templateList" value="#{qtBeanParam.templateList}" /> </rich:comboBox> <h:outputText value="Owners:" style="font-weight:bold" /> <rich:comboBox id="templateOwner" width="160" value="#{qtBeanParam.templateOwner}" enableManualInput="false" > <f:selectItems id="templateOwnerList" value="#{qtBeanParam.templateOwnersList}" /> </rich:comboBox> <a4j:commandButton id="saveTemplate" value="Save" action="#{qtBeanParam.saveTemplate}" immediate="false" reRender="template,templateList,templateOwner,templateOwnerList" styleClass="blue-button"> </a4j:commandButton> <a4j:commandButton id="deleteTemplate" value="Delete" action="#{qtBeanParam.deleteTemplate}" immediate="true" reRender="template,templateList,templateOwner,templateOwnerList" styleClass="blue-button"> <a4j:actionparam name="tempname" value="#{template}" assignTo="#{qtBeanParam.templateName}"></a4j:actionparam> </a4j:commandButton> </h:panelGrid>
Backing bean method:
public void deleteTemplate() { final String user = usrSecurityBean.getUserID(); // templateName is shown on the screen, but is null or empty when at this point if ( templateName == null || templateName.equals("")) { showMessage("piPerformanceReturnsForm:templateParams", "Template name should be selected."); return; } ...
Thanks a lot in advance,
Leonid