jsf 2 - Two <p:confirmDialog> in one xhtml -
i have 2 in 1 xhtml. both of them not working properly. when click save button, confirmdialog of import button came up. when click import button, nothing came up. there have missed out?
<td><p:commandbutton type="button" value="save" id="cr1002_command_save" onclick="confirmation.show()" ajax="false" style="width: 80px;height: 24px"> </p:commandbutton> <p:confirmdialog id="confirmdialog" message="#{msg.cr1002_prompt_confirm_save}" severity="alert" widgetvar="confirmation" style="width: 70px;height: 27px"> <p:commandbutton id="confirm" value="ok" oncomplete="confirmation.hide()" action="#{pc_cr1002.docr1002_command_saveaction}" ajax="false" style="width: 80px;height: 24px" /> <p:commandbutton id="decline" value="cancel" onclick="confirmation.hide()" type="button" style="width: 80px;height: 24px" /> </p:confirmdialog></td> <td></td> <td><p:commandbutton type="button" value="import" onclick="gowait('form1:cr1002_command_import')" id="cr1002_command_import" ajax="false" style="width: 80px;height: 24px"></p:commandbutton> <p:confirmdialog id="confirmdialog2" message="importing... importing..." severity="alert" widgetvar="confirmation" style="width: 70px;height: 27px"> <p:commandbutton id="confirm2" value="ok" oncomplete="confirmation.hide()" action="#{pc_cr1002.docr1002_command_importaction}" ajax="false" style="width: 80px;height: 24px" /> <p:commandbutton id="decline2" value="cancel" onclick="confirmation.hide()" type="button" style="width: 80px;height: 24px" /> </p:confirmdialog> </td>
the problem come same widgetvar attribute, attribute use in client side, cause conflict in client side, should code as:
<td><p:commandbutton type="button" value="save" id="cr1002_command_save" onclick="confirmation.show()" ajax="false" style="width: 80px;height: 24px"> </p:commandbutton> <p:confirmdialog id="confirmdialog" message="#{msg.cr1002_prompt_confirm_save}" severity="alert" widgetvar="confirmation" style="width: 70px;height: 27px"> <p:commandbutton id="confirm" value="ok" oncomplete="confirmation.hide()" action="#{pc_cr1002.docr1002_command_saveaction}" ajax="false" style="width: 80px;height: 24px" /> <p:commandbutton id="decline" value="cancel" onclick="confirmation.hide()" type="button" style="width: 80px;height: 24px" /> </p:confirmdialog></td> <td></td> <td><p:commandbutton type="button" value="import" onclick="confirmation2.show()" id="cr1002_command_import" ajax="false" style="width: 80px;height: 24px"></p:commandbutton> <p:confirmdialog id="confirmdialog2" message="importing... importing..." severity="alert" widgetvar="confirmation2" style="width: 70px;height: 27px"> <p:commandbutton id="confirm2" value="ok" oncomplete="confirmation.hide()" action="#{pc_cr1002.docr1002_command_importaction}" ajax="false" style="width: 80px;height: 24px" /> <p:commandbutton id="decline2" value="cancel" onclick="confirmation.hide()" type="button" style="width: 80px;height: 24px" /> </p:confirmdialog> </td>
Comments
Post a Comment