Hello,

I found a solution. The following code is actually all that was needed:

public class AjaxFormValidatingBehavior extends */AjaxFormComponentUpdatingBehavior /*{
   private final Component feedbackPanel;

public AjaxFormValidatingBehavior(String event, Component feedbackPanel) {
       super(event);
       this.feedbackPanel = feedbackPanel;
   }

   protected void onUpdate(final AjaxRequestTarget target) {
       target.addComponent(feedbackPanel);
   }

   public static void addToAllFormComponents(
final String event, final Form form, final Component feedbackPanel) {

       form.visitChildren(FormComponent.class, new IVisitor() {
           public Object component(Component component) {
component.add(new AjaxFormValidatingBehavior(event, feedbackPanel));
               return IVisitor.CONTINUE_TRAVERSAL_BUT_DONT_GO_DEEPER;
           }
       });
   }
}

Note that this version of AjaxFormValidatingBehavior has a different base class then the Wicket version.
Use it like this:
AjaxFormValidatingBehavior.addToAllFormComponents("onchange", form, feedbackPanel);


Regards,
    Erik.


--
Erik van Oosten
http://www.day-to-day-stuff.blogspot.com/

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to