0

In one of my project we are using jsf/primefaces for development and have specific requirement not to make any ajax call on blur or change event of input field.

We need to display list of record. User can also add or delete records.

I am using below xhtml cocde

       <h:form id="wizard_form">
    <p:outputPanel id="idBiomassPlantsPanel">
        <ui:repeat var="item" value="#{controller.iteamList}">
            <p:inputText id="field1" value="#{item.field}">
                <f:validateLongRange maximum="10" minimum="2" />
            </p:inputText>
            <p:message display="text" for="field1" />
            <p:commandLink id="idDeleteBiomassPlantsLink" value="Delete record"
                update="wizard_form:idBiomassPlantsPanel" immediate="true"
                process="@this" actionListener="#{controller.deleteBioMassPlants()}">
            </p:commandLink>
        </ui:repeat>
        <p:inputText id="testfield" value="#{controller.field}">
            <f:validateLongRange maximum="10" minimum="2" />
        </p:inputText>
    </p:outputPanel>
    <p:commandButton id="addBiomassPlantsButton" value="add new"
        action="#{controller.addBioMassPlantsData}" update="@form"
        process="@form" />
</h:form>

On click of "add new" button we are processing whole UI form. This button is working fine. if user clicks of "Delete record" button, i do not want to trigger validation since even incorrect values are entered user should be able to delete the record. I have used immediate=”true” to skip validation but in this case all input fields gets reset to NULL or initial value of other records which is not deleted( eg: if i enter three record and second record is deleted then value of third record is updated with null.)

I tried removing immediate="true" as i am using process="@this" then also i am facing same issue.

I created one test input field outside of UI repeat. Value of this field is not changed on click of delete button. So it seems issue is with only input fields whict are inside UI:repeat.

Any help or pointer on this is much appreciated.

Avanish
  • 1
  • 1
  • 1
    Welcome to SO, in its current form your question is very hard to answer, mainly because you didn't provide any code. Please read [ask] – Hintham Oct 30 '18 at 10:34
  • Hi, when you enrolled to Stackoverflow, the requested you to read [ask] Please do and improve your question like @Hintham. And ajax can be used with buttons too. In combination with update/render, execute/process, the `immediate="true"` is rarely needed then. – Kukeltje Oct 30 '18 at 10:38
  • I have updated question with more details. @Kukeltje: I have tried different combination of process and update but it did not work. – Avanish Oct 30 '18 at 12:37
  • remove `immediate="true"` on the commandLink. And 'it did not work' meaning? Starts WW-III? How do responses look like? What is happening. Describe like a developer, not like an end-user. – Kukeltje Oct 30 '18 at 13:04
  • At least you need to read updated question once before keep on adding boring funny comment. I already mentioned that i have tried removing immediate="true" and used process="@this" in my updated question. But it seems you missed these parts while enjoying your imaginary funny WW-III comment. – Avanish Oct 30 '18 at 13:21

0 Answers0