2

My question is somewhat similar to this one here.

I have a form Parent with a few commandButtons one for each of the several entries on the page/form. When I click on the commandButton C1 for an entry, say, E1, a new form, Child pops up with some fields on it populated thru an AJAX call.

If I cause a validation error on this form Child by, say, submitting the form with some required fields missing, I get the validation error back, which is all good.

Now, when I exit the pop-up, get back on the form Parent and click the commandButton C2 of a different entry E2, the form in the popup, Child, contains the details of that of the E1, despite the ajax call on the click of the commandButton C2 to load the information corresponding to the entry E2. In fact, opening any entry from the Parent after that always displays the details of the entry E1 in the popup's form: Child until I actually refresh/reload the page.

Using the resetValues="true" on the commandButtons doesn't seem to have any impact. Any suggestion?

Community
  • 1
  • 1
mystarrocks
  • 4,040
  • 2
  • 36
  • 61
  • To exclude one and other, does a nested `` work? – BalusC May 28 '15 at 18:45
  • @BalusC Perfect, that works! And thinking about it, it does make sense to reset the elements in the dialog, given by `dialogId`! I'll accept this answer once you add it as one. – mystarrocks May 28 '15 at 19:19
  • I only wonder why `resetValues="true"` didn't work then. Which PF version? – BalusC May 28 '15 at 19:37
  • @BalusC Primefaces v5.1. I must admit I haven't read the exact working of `resetValues`, but `resetInput` as a separate nested element with a target component sounds sensible to me. What values exactly are attempted for a reset with `resetValues="true"` (with a nested `resetInput` with a `target`, this is obvious)? – mystarrocks May 28 '15 at 20:33
  • It will reset anything specified in `update`. So this problem can happen if you don't have `update=":dialogId"`, but that would in turn be strange as that conflicts your intent (showing detail of current item in dialog). – BalusC May 29 '15 at 05:41

0 Answers0