Reputation: 23
I'm trying to update the inputtext with id callef in the form formUsuario and its bean is psFacNomVialidad that also is in MigracionController however, I'm trying to make that update using the value inputted in my inputtext with id calle this inputtex is in another form (dlgFormVerif) and has its own bean (psNomVialidad), the value of psFactNomVialidad is the same as psNomVialidad because a method is triggered after the dialog is closed that assigns values and also updates formUsuario but for some reason is not working, what am I missing?.
MigracionController.java
@ManagedBean
@ViewScoped
public class MigracionController extends AbstractBaseController {
@Getter @Setter
private String psNomVialidad;
@Getter @Setter
private String psFacNomVialidad;
...
public void verificarDatosFacturacion() {
...
psFacNomVialidad = psNomVialidad;
...
}
...
}
migracion5.xhtml
<h:form role="form" id="formUsuario" enctype="multipart/form-data">
...
<p:panel id="DomFacturacion" class="panel" visible="#{(migracionController.pbDesDatoFacturacion)}">
...
<p:inputText id="callef" class="inputTextForm" value="#{migracionController.psFacNomVialidad}"
required="true" rendered="#{(migracionController.pbDesDatoFacturacion)}"/>
...
</p:panel>
...
<h:form>
.
.
.
<p:commandButton value="VERIFY INFO" id="showDlgVerif" class="btn" rendered="true" oncomplete="PF('dlgVerif').show();"/>
.
.
.
<p:dialog id="dlgVerif" header="Verify info" class="modal" widgetVar="dlgVerif" modal="true"
resizable="false" closable="true">
<p:ajax event="close" listener="#{migracionController.verificarDatosFacturacion()}" update=":formUsuario:DomFacturacion"/>
<h:form id="dlgFormVerif" rendered="true">
<input type="hidden" name="${_csrf.parameterName}" id="${_csrf.parameterName}" value="${_csrf.token}"/>
<p:panel styleClass="panel" rendered="true">
...
<p:inputText styleClass="inputTextForm" id="calle"
value="#{migracionController.psNomVialidad}"
required="#{!migracionController.pbClteExistente}">
<p:ajax event="change" update=":formUsuario:callef"/>
</p:inputText>
...
</p:panel>
</h:form>
<p:commandButton styleClass="btnAzul" value="CLOSE" oncomplete="PF('dlgVerif').hide();"/>
</p:dialog>
Upvotes: 0
Views: 693
Reputation: 23
I was updating my items in the front but I wasn't processing them so as WoAiNii suggested in comments I added process
attribute for p:ajax
tag and changed the values to achieve what I wanted.
Here is the result
<h:form role="form" id="formUsuario" enctype="multipart/form-data">
...
<p:panel id="DomFacturacion" class="panel" visible="#{(migracionController.pbDesDatoFacturacion)}">
...
<p:inputText id="callef" class="inputTextForm" value="#{migracionController.psFacNomVialidad}"
required="true" rendered="#{(migracionController.pbDesDatoFacturacion)}"/>
...
</p:panel>
...
<h:form>
.
.
.
<p:commandButton value="VERIFY INFO" id="showDlgVerif" class="btn" rendered="true" oncomplete="PF('dlgVerif').show();"/>
.
.
.
<p:dialog id="dlgVerif" header="Verify info" class="modal" widgetVar="dlgVerif" modal="true"
resizable="false" closable="true">
<p:ajax event="close" listener="#{migracionController.verificarDatosFacturacion()}" update=":formUsuario:DomFacturacion"/>
<h:form id="dlgFormVerif" rendered="true">
<input type="hidden" name="${_csrf.parameterName}" id="${_csrf.parameterName}" value="${_csrf.token}"/>
<p:panel styleClass="panel" rendered="true">
...
<p:inputText styleClass="inputTextForm" id="calle"
value="#{migracionController.psNomVialidad}"
required="#{!migracionController.pbClteExistente}">
<!-- the changes are on the below line -->
<p:ajax event="change" process=":formUsuario:callef" update="calle"/>
</p:inputText>
...
</p:panel>
</h:form>
<p:commandButton styleClass="btnAzul" value="CLOSE" oncomplete="PF('dlgVerif').hide();"/>
</p:dialog>
Upvotes: 1