Heyvaert / wiquery

Automatically exported from code.google.com/p/wiquery
0 stars 0 forks source link

Dialog demo uses Wicket API method that isnt supposed to be used #206

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
DialogPage.java in wiquery-demos has the following code:

        AbstractDefaultAjaxBehavior formAjaxBehavior = new AbstractDefaultAjaxBehavior() {
            private static final long serialVersionUID = 1L;

            /* (non-Javadoc)
             * @see org.apache.wicket.ajax.AbstractDefaultAjaxBehavior#respond(org.apache.wicket.ajax.AjaxRequestTarget)
             */
            @Override
            protected void respond(AjaxRequestTarget target) {
                // Here, we retrieve data form the form of the advanced dialog
                form.onFormSubmitted();

                if(form.hasError()){
                    // Error
                    target.addComponent(feedback);
                } else {
                    getSession().cleanupFeedbackMessages();
                    target.prependJavascript("alert('Thank you [" + 
                            nameField.getModelObject() + "]')");
                    advancedDialog.close(target);
                }
            }
        };

According to Wicket API (1.4.18), Form.onFormSubmitted should not be used.

Is there an alternative method to achieve the same functionality?

Original issue reported on code.google.com by nbpr...@gmail.com on 11 Sep 2011 at 1:30

GoogleCodeExporter commented 9 years ago
Title should be "Dialog demo" not "Dialog demon"

Original comment by nbpr...@gmail.com on 11 Sep 2011 at 1:32

GoogleCodeExporter commented 9 years ago

Original comment by hielke.hoeve on 12 Sep 2011 at 8:30

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Sorry for the long wait...

You can mimmick the effect by using this snippit from Form line 737:

// First, see if the processing was triggered by a Wicket 
IFormSubmittingComponent
if (submitter == null)
{
    submitter = findSubmittingButton();
}

// When processing was triggered by a Wicket IFormSubmittingComponent and that
// component indicates it wants to be called immediately
// (without processing), call IFormSubmittingComponent.onSubmit() right away.
if (submitter != null && !submitter.getDefaultFormProcessing())
{
    submitter.onSubmit();
}
else
{
    // this is the root form
    Form<?> formToProcess = this;
    // find out whether it was a nested form that was submitted
    if (submitter != null)
    {
        formToProcess = submitter.getForm();
    }

    // process the form for this request
    formToProcess.process(submitter);
}

Original comment by hielke.hoeve on 26 Oct 2011 at 7:20

GoogleCodeExporter commented 9 years ago

Original comment by hielke.hoeve on 26 Oct 2011 at 7:20

GoogleCodeExporter commented 9 years ago
any other questions about the examples should be asked in wiquery-plugins.

Original comment by hielke.hoeve on 10 Nov 2011 at 8:18