On Mon, Mar 17, 2008 at 11:44:19AM -0700, BertrandDatas wrote:
> 
> Yes, surely I could but it is not the case I want to make the validation
> during the onSubmit of a dynamically generated button which is embed in a
> panel and this panel is in the form that I want to validate , so I cannot do
> this.  
> 
> Thanks for your purpose, may be you have an other idea about my problem ?
> 

You can put your validation in a FormValidator, but the trick is to add
it to the form *after* your panel is added to it's parent by overriding
onBeforeRender:

public class MyPanel extends Panel {

    private boolean formValidatorRegistered;

    @Override
    protected void onBeforeRender() {
        if (!formValidatorRegistered) {
            Form form = (Form) findParent(Form.class);
            if (form != null) {
                form.add(new AbstractFormValidator() { ... });
                formValidatorRegistered = true;
            }
        }
    }
}

Hope this helps.

jk

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

Reply via email to