Thanks very much You have " addValueChangeListener(this)". I assume instead I should be adding the VCL class as a listener, not the phase listener. Similar, you have the assignableFrom code which doesn't compile. The goal there is just to check if there are any VCL's of thar particular type type assigned to this class, right?
I'm pretty sure I understand what you're doing here, and I like it. Just clarifying. Thanks. -----Original Message----- From: Andrew Robinson [mailto:[EMAIL PROTECTED] Sent: Friday, July 13, 2007 12:24 PM To: MyFaces Discussion Subject: Re: Detecting whether or not the user changed anything on a form > I think this will do unless you can think of a way to avoid having to add the VCL tag to every component. This is when you may consider a PhaseListener, or component binding. You could surf the entire component tree recursively, and add your VCL to all components implementing EditableValueHolder. public class VCLPhaseListener implement PhaseListener { public void afterPhase(PhaseEvent event) { } public void beforePhase(PhaseEvent event) { UIViewRoot viewRoot = event.getFacesContext().getViewRoot(); if (viewRoot != null) { addVCL(viewRoot); } } public PhaseId getPhaseId() { return PhaseId.PROCESS_VALIDATIONS; } private void addVCL(UIComponent component) { if (component instanceof EditableValueHolder && !hasVCL((EditableValueHolder)component)) { ((EditableValueHolder)component).addValueChangeListener(this); } for (Iterator iter = component.getFacetsAndChildren(); iter.hasNext(); ) { addVCL(iter.next()); } } private boolean hasVCL(EditableValueHolder holder) { for (ValueChangeListener listener : holder.getValueChangeListeners()) { if (VCLPhaseListener.class.assignableFrom(listener.getClass())) { return true; } } return false; } ... VCL Code } ----------------------------------------- ***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.

