0

I have a JSF - xhtml page with New, Save, Delete , Print , Close command buttons.

We have applied few validations on the input controls and those are working well on delete and save. For close button we have set "immediate=true" to disallow validation which are also working fine.

But we also want to notify user if he changes the value in any of the input control and then chooses to close the form, that "he has left with some unsaved changes" , since the close button has been set for immediate true, it does not recognizes the changes in the values also valuechangeListerner not works on close if immediate = true is set for it.

Like to know the approach to be taken in this case....

Thanks

NKS
  • 1,140
  • 4
  • 17
  • 35

1 Answers1

0

With immediate="true" on the button, the action is indeed invoked during apply request values phase and all the remaining phases are skipped. That's also the sole point of this attribute: process (decode, validate, update and invoke) the component immediately during apply request values phase.

All inputs which do not have immediate="true" are ignored anyway. Only inputs which do have immediate="true" are also processed, but this happens also during apply request values phase. Why should the remaining phases be invoked if everything has already taken place in the apply request values phase?

In the Debug JSF lifecycle article you can find the following summary which should enlighten when to (not) use the immediate"true"

Please refer Trying to understand immediate="true" skipping inputs when it shouldn't

Community
  • 1
  • 1
Hemant Metalia
  • 29,730
  • 18
  • 72
  • 91