Wednesday, May 18, 2022

[FIXED] How to process only the primefaces dialog in commandButton action?

Issue

My problem is. I have a primefaces dialog (modal window). Inside it has a commandbutton. When i open the dialog and click in commandbutton, then the inputs outside and behind dialog are validated too. I want process only the inputs inside dialog.

Important say that the i add the dialog in my page by . The dialog is in other file (include).

I tried use process="dialog id" attribute but not work.

Can anyone help me?


Solution

The commandButton generates a POST request submitting the form data of the form enclosing this button to the server. If you want to submit only the form inputs on the dialog enclose the dialog with a <h:form> and to get away with the problem of nesting the forms use appendToBody attribute on the dialog like this:

<p:dialog appendToBody="true">
  <h:form>
  </h:form>
</p:dialog>

This way dialog form will be outside the parent form.



Answered By - Ravi Kadaboina
Answer Checked By - Mary Flores (PHPFixing Volunteer)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.