0
votes

I have the following problem I have a CommandButton of primefaces that does well its function which is to save an accounting movement, but when you try to enter a second movement the button does not work to such an extent that it does not warn you if the required fields are empty. Note that if I give the cancel button that only has a JS to hide and show some labels there is if the button works again.

I need that button to continue working without having to hit the cancel button.

I'm going to leave a partial code that includes the TAG of the form and the buttons warn if you need to also put the fields.

<h:form id="form_agregar_movimiento" prependId="false" >
   ...
<p:commandButton styleClass="Tamano-Texto-Datos Boton-Afirmativo" 
    value="Agregar"
    action="#{movimientosController.agregarNuevoMovimiento()}" 
    update=":growl_mensaje_eventos :dataTable_listar_movimientos form_agregar_movimiento"
    />
<p:commandButton styleClass="Tamano-Texto-Boton Boton-Negativo" 
    value="Cancelar"
    onclick="js_ocultar('agregar_movimiento_contenedor'); js_mostrar('movimiento_contenedor_botonAgregarMovimiento');"/>
</h:form>
1
Maybe you have to update=":form_agregar_movimiento" from inside the form or update="@form".Holger
hello, I have tried both methods and change the "prependId = true" and the problem follows.David Valado

1 Answers

0
votes

594/5000 Hi guys, I have solved the problem, I noticed that other forms presented the same problem and testing by ending with @form as recommended and the "prependId = true" and additional add the attribute resetValues="true" and with And the buttons come back to work without problems.

Note: in the example that this function did not work for me but it was for something else, I had a RequestContext.getCurrentInstance().Execute() which calls a JavaScript and it was giving me an error in the browser, I corrected it and works correctly. Thanks for the tips that have left me