Hello guys,

I'm having a little problem with the use of AjaxFormValidatingBehavior. I add it to all my fields, using a visitor.

            form.visitChildren(FormComponent.class, new IVisitor() {
            public Object component(Component component) {
                if (component instanceof TextField) {
                    component.add(new AjaxFormValidatingBehavior(form, "onkeyup") {
                        private static final long serialVersionUID = 1L;
                       
                        @Override
                        protected void onError(AjaxRequestTarget target) {
                            super.onError(target);
                            updateFieldsCssClasses();
                        }
                       
                        @Override
                        protected void onSubmit(AjaxRequestTarget target) {
                            super.onSubmit(target);
                            updateFieldsCssClasses();
                        }
                    });
                } else if (component instanceof DropDownChoice || component instanceof CheckBox) {
                    component.add(new AjaxFormValidatingBehavior(form, "onclick") {
                        private static final long serialVersionUID = 1L;
                       
                        @Override
                        protected void onError(AjaxRequestTarget target) {
                            super.onError(target);
                            updateFieldsCssClasses();
                        }
                       
                        @Override
                        protected void onSubmit(AjaxRequestTarget target) {
                            super.onSubmit(target);
                            updateFieldsCssClasses();
                        }
                    });
                }
               
                return null;
            }
        });



But when this code is rendered, it throws this exception:
org.apache.wicket.util.io.SerializableChecker$WicketNotSerializableException: Unable to serialize class: xxx$10
Field hierarchy is:
  2 [class=xxx, path=2]
...
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.NotSerializableException: xxx.$10
    at java.io.ObjectOutputStream.writeObject0(Unknown Source)
    at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source)
However, AjaxFormValidatingBehavior implements Seriablizable... so I don't understand why Wicket complains about it...

Have I miss something?

PS: it works this way under at least 1.3.0 and 1.3.1


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to