I have a JSF page in which I repeat the list to display <h:dataTable> with some lines containing a check box, some text and a text box. I added checks in such a way that if the chechbox is checked in a line, the user must enter a value in the corresponding text box. In addition, I have a checkbox with the identifier 'copy' over <h:dataTable> , which should copy the value entered in the first text field to all other text fields whose checkboxes are marked in <h:dataTable> . I used an ajax call for the same.
<h:form prependId="false" id="form"> <h:selectBooleanCheckbox value="#{bean.copy}" id="copy"> <p:ajax process="#{bean.mailId}" event="change" partialSubmit="true" listener="#{Controller.copyEmail()}" update="rm"> </p:ajax> </h:selectBooleanCheckbox> <h:dataTable id="rm" width="100%" cellspacing="4" value="#{controller.alertTriggers}" var="alt" columnClasses="c1,c2,c3,c4"> <h:column> <h:selectBooleanCheckbox value="#{alt.checkValue}" id="checkbox" binding="#{checkbox}"/> </h:column> <h:column> <h:outputText value="#{alt.id}" /> </h:column> <h:column> <h:outputFormat value="#{alt.msg1}" /> </h:column> <h:column> <h:message for="emailID" id="email" styleClass="validation-error"/> <h:inputText value="#{alt.mailId}" id="emailID" style="width: 87%;" required="#{checkbox.value}" requiredMessage="Enter the value"/> </h:column> </h:dataTable> </h:form>
In the controller
public void copyEmail() {
The check works fine, but when I check the copy box, the value of the text field is not copied to other text fields. Instead, validation errors are displayed. If I remove the checks from the text box, the copy part is working fine.
I tried using immediate=true for my ajax call, but then the value of the checkboxes inside <h:dataTable> not updated inside the controller.
So, in the summary
I want to disable my checks during ajax call. Is there any way to do this other than immediate=true ?
source share