Thanks. Pardon my inexperience as I think this through

So I could write a phase listener that would check for queued ValueChangeEvents 
during the validation phase and the listener would set some flag on one backing 
bean. The flag would indicate "Did the last JSF form submission that occurred 
contain any changes?" I also have to be careful of the scoping of that bean 
since it's shared across all pages. I think session would work.

Does that design make sense? I'm new to PhaseListeners and the right way to use 
them.

Dan


 -----Original Message-----
From: Andrew Robinson [mailto:[EMAIL PROTECTED] 
Sent: Friday, July 13, 2007 10:52 AM
To: MyFaces Discussion
Subject: Re: Detecting whether or not the user changed anything on a form

If at least one ValueChangeEvent is queued (by a UIInput component)
during the validation pahse, then something has changed.

On 7/13/07, Hannum, Daniel <[EMAIL PROTECTED]> wrote:
>
>
>
>
> Hi,
>
>
>
> I have a form for editing a business entity. The form is prepopulated with
> the current values and the user can change everything and hit the submit
> button when their done. Fairly simple. What's tricky is that I'd like to
> only show a confirmation ("Changes saved") message if they actually changed
> something instead of just submitting the same values as before.
>
>
>
> The naïve way is to check each backing bean field against the field in the
> business entity, but that's unmaintainable when the object starts changing.
> Is there a framework-based way to detect this? I want to avoid having to
> enumerate every field when I check. I want to know that _at least one_ of
> the fields on the page has a submitted value different from the model value.
> (I think I got the terminology right)
>
>
>
> Maybe the answer lies in a phase listener that would somehow do that check,
> my experience with that is limited. Please let me know if this is possible
> or not.
>
>
>
> And I'm using MyFaces and Trinidad so hopefully it would only use mechanisms
> include in those projects.
>
>
>
> Thanks
>
> Dan
>
>
> ________________________________
>
>
>
>
>  ***Note:The information contained in this message may be privileged and
> confidential and protected from disclosure. If the reader of this message is
> not the intended recipient, or an employee or agent responsible for
> delivering this message to the intended recipient, you are hereby notified
> that any dissemination, distribution or copying of this communication is
> strictly prohibited. If you have received this communication in error,
> please notify the Sender immediately by replying to the message and deleting
> it from your computer. Thank you. Premier Inc.

-----------------------------------------
***Note:The information contained in this message may be privileged
and confidential and protected from disclosure. If the reader of
this message is not the intended recipient, or an employee or agent
responsible for delivering this message to the intended recipient,
you are hereby notified that any dissemination, distribution or
copying of this communication is strictly prohibited. If you have
received this communication in error, please notify the Sender
immediately by replying to the message and deleting it from your
computer. Thank you. Premier Inc.

Reply via email to