1

我有一个 PopupPanel,里面有一个表格。该表单之前已由 ajax 渲染,因此由于 Richfaces 的一些问题/错误,我不得不将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。

4

1 回答 1

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..

于 2012-07-24T09:21:25.667 回答