我有一个内部有一个表单的PopupPanel。该表单之前已由ajax呈现,因此通过富表面的某些问题/错误,我被迫将a4j:commandButton
放在表单之外,并带有execute
属性。
当我点击按钮时,它会调用服务器,但bean值不会更新。
有什么建议吗?
我的表格的简单代码:
<rich:popupPanel id="workOrderPopup" modal="true" resizeable="true"
onmaskclick="#{rich:component('workOrderPopup')}.hide()" width="750" height="420">
<h:form id="editWorkOrderForm" onkeypress="if (event.keyCode == 13) { document.getElementById('workOrderEdition:saveWO').click(); return false; }">
[[[FORM FIELDS]]]
</h:form>
<a4j:commandButton id="createWO" value="Guardar" action="#{ticketCont.saveWorkOrder()}"
render="workOrders,footer" execute="editWorkOrderForm" oncomplete="#{rich:component('workOrderPopup')}.hide()"/>
</rich:popupPanel>
我的表格的完整代码:
<rich:popupPanel id="workOrderPopup" modal="true" resizeable="true"
onmaskclick="#{rich:component('workOrderPopup')}.hide()" width="750" height="420">
<h:form id="editWorkOrderForm" onkeypress="if (event.keyCode == 13) { document.getElementById('workOrderEdition:saveWO').click(); return false; }">
<table width="100%" id="editWorkOrderTable">
<tr>
<td>
<h:outputText value="ID" for="editedWOId"/><br/>
<h:inputText value="#{ticketCont.workOrder.id}" id="editedWOId" readonly="true" size="7"/>
</td>
<td>
<h:outputText value="Descripción" for="editedWODescription"/><br/>
<h:inputText value="#{ticketCont.workOrder.description}" id="editedWODescription"/>
</td>
<td>
<h:outputText value="Estado" for="editedWOState"/><br/>
<h:selectOneListbox value="#{ticketCont.workOrder.status}">
<f:selectItem itemLabel="Abierto" itemValue="0"/>
<f:selectItem itemLabel="Cerrado" itemValue="1"/>
</h:selectOneListbox>
</td>
<td>
<h:outputText value="Tiempo (en horas)" for="editedWOTime"/><br/>
<rich:inputNumberSpinner value="#{ticketCont.workOrder.workHours}" inputSize="4"/>
</td>
</tr>
<tr>
<td colspan="4">
<div align="center">
<h:outputText value="Recursos" for="editedWOResources"/><br/>
<rich:pickList value="#{ticketCont.workOrder.resources}" var="_resource" listHeight="200px" id="editedWOResources">
<f:selectItems value="#{ticketCont.activeResources}"/>
<f:converter converterId="es.caib.gesma.gesman.data.converter.ResourceConverter" />
<rich:column>
#{_resource.name}
</rich:column>
</rich:pickList>
</div>
</td>
</tr>
</table>
</h:form>
<a4j:commandButton id="createWO" value="Guardar" action="#{ticketCont.saveWorkOrder()}"
render="workOrders,footer" execute="editWorkOrderForm" oncomplete="#{rich:component('workOrderPopup')}.hide()"/>
</rich:popupPanel>
我正在使用JBoss 6.1,Mojarra 2.1.9和Richfaces 4。
答案 0 :(得分:2)
我认为问题不在这个代码中,但是来自其他点击你的editWorkOrderForm的问题是渲染你的from不工作... 因为你可以这样做..
<rich:popupPanel id="workOrderPopup" modal="true" resizeable="true"
onmaskclick="#{rich:component('workOrderPopup')}.hide()" width="750" height="420">
<h:form id="editWorkOrderForm" onkeypress="if (event.keyCode == 13) { document.getElementById('workOrderEdition:saveWO').click(); return false; }">
<a4j:outputpanal id="editWorkOrderPanal">
<table width="100%" id="editWorkOrderTable">
<tr>
<td>
<h:outputText value="ID" for="editedWOId"/><br/>
<h:inputText value="#{ticketCont.workOrder.id}" id="editedWOId" readonly="true" size="7"/>
</td>
<td>
<h:outputText value="Descripción" for="editedWODescription"/><br/>
<h:inputText value="#{ticketCont.workOrder.description}" id="editedWODescription"/>
</td>
<td>
<h:outputText value="Estado" for="editedWOState"/><br/>
<h:selectOneListbox value="#{ticketCont.workOrder.status}">
<f:selectItem itemLabel="Abierto" itemValue="0"/>
<f:selectItem itemLabel="Cerrado" itemValue="1"/>
</h:selectOneListbox>
</td>
<td>
<h:outputText value="Tiempo (en horas)" for="editedWOTime"/><br/>
<rich:inputNumberSpinner value="#{ticketCont.workOrder.workHours}" inputSize="4"/>
</td>
</tr>
<tr>
<td colspan="4">
<div align="center">
<h:outputText value="Recursos" for="editedWOResources"/><br/>
<rich:pickList value="#{ticketCont.workOrder.resources}" var="_resource" listHeight="200px" id="editedWOResources">
<f:selectItems value="#{ticketCont.activeResources}"/>
<f:converter converterId="es.caib.gesma.gesman.data.converter.ResourceConverter" />
<rich:column>
#{_resource.name}
</rich:column>
</rich:pickList>
</div>
</td>
</tr>
</table>
<a4j:commandButton id="createWO" value="Guardar" action="#{ticketCont.saveWorkOrder()}"
render="workOrders,footer" oncomplete="#{rich:component('workOrderPopup')}.hide()"/>
</a4j:outputPanal>
</h:form>
</rich:popupPanel>
现在单击弹出窗口在render="editWorkOrderPanal"
打开,这是工作4 u ..