I would propose the following patch to AjaxFormSubmitBehavior. Basically adding a form-less constructor so that when the form obejct is not specified it will discovered using the findParent(Form.class) method.
Core developers what do you think about it ? Paolo abstract public class AjaxFormSubmitBehavior extends AjaxEventBehavior{ private Form form; public LazyFormSubmitBehavior(String event) { super(event); } public LazyFormSubmitBehavior( Form form, String event ) { super(event); this.form = form; } protected Form getForm() { if( form == null ) { form = (Form) getComponent().findParent(Form.class); /* form component cannot be null */ if( form == null ) { throw new IllegalStateException("Unable to discover parent form object. Try to override getForm() method with different deferred strategy"); } } return form; } @Override protected CharSequence getEventHandler() { final String formId = getForm().getMarkupId(); final CharSequence url = getCallbackUrl(); AppendingStringBuffer call = new AppendingStringBuffer("wicketSubmitFormById('").append(formId).append("', '").append(url).append("', "); if (getComponent() instanceof Button) { call.append("'").append(((FormComponent)getComponent()).getInputName()).append("' "); } else { call.append("null"); } return getCallbackScript(call, null, null) + ";"; } @Override protected void onEvent(AjaxRequestTarget target) { getForm().onFormSubmitted(); if (!getForm().hasError()) { onSubmit(target); } else { onError(target); } } protected abstract void onSubmit(AjaxRequestTarget target); protected void onError(AjaxRequestTarget target) { } } On Jan 7, 2008 9:45 AM, Fabio Fioretti <[EMAIL PROTECTED]> wrote: > Thanks everybody for the precious help, a custom lazy > AjaxFormSubmitBehavior was the way to go. > > > Fabio Fioretti - WindoM > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >