Weird behavior with AbstractFormDialog submit

85 views
Skip to first unread message

Sebastien Briquet

unread,
Oct 25, 2013, 9:49:18 AM10/25/13
to wicket-j...@googlegroups.com
Hi all,

I have got a really weird issue (even not dramatic), for which my current investigation does not helps me to understand what's happening.... So, in case someone already faced a similar issue...

In short: I've got AbstractFormDialog with Buttons, Buttons are not standard wicket buttons, so the interaction is done through an extended/custom AbstractDefaultAjaxBehavior.
The dialog's Form submission is handled by a custom IFormSubmitter, as it is done in AjaxButton with its AjaxFormSubmitBehavior

All is working well (inner form-components are submitted) as long as the form is instantiated in the constructor. If the form is instantiated in #onInitialized, inputs are not sent when clicking on the dialog's button.
However, a standard AjaxButton will do the job correctly. So, I probably missed something somewhere, but I cannot figure out where....

Many thanks in advance for your help!
Sebastien.

PS: attached sample quickstart.

issue-abstractformdialog.zip

Martin Grigorov

unread,
Oct 29, 2013, 4:21:20 AM10/29/13
to wicket-j...@googlegroups.com
Hi Sebastien,

Any progress on this ?
I can try to debug it later today if this is still unsolved.


--
You received this message because you are subscribed to the Google Groups "wicket-jquery-ui" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wicket-jquery-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/wicket-jquery-ui/0440cd78-4e84-4c93-9961-b68a5cfc02df%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Sebastien

unread,
Oct 29, 2013, 4:35:38 AM10/29/13
to wicket-j...@googlegroups.com
Hi Martin,

No progress actually, I am still stuck on this... (because I do not understand what the difference between instantiating the form in the ctor and in the #onInitialize...)

Thank you very much in advance!
Sebastien.

Martin Grigorov

unread,
Oct 31, 2013, 10:18:31 AM10/31/13
to wicket-j...@googlegroups.com
And I finally found time to check this.
The text in the input field is correctly submitted and printed for me.
I didn't change any code in the app.

I use Chrome 30 as a browser. Which browser do you use ?


--
You received this message because you are subscribed to the Google Groups "wicket-jquery-ui" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wicket-jquery-...@googlegroups.com.

Martin Grigorov

unread,
Oct 31, 2013, 10:20:16 AM10/31/13
to wicket-j...@googlegroups.com
On Thu, Oct 31, 2013 at 4:18 PM, Martin Grigorov <martin....@gmail.com> wrote:
And I finally found time to check this.
The text in the input field is correctly submitted and printed for me.
I didn't change any code in the app.

Actually I changed the version of wicket-jquery-ui to 6.11.0 because I don't have 6.11.1-SNAPSHOT here.
Let me build me.  

Martin Grigorov

unread,
Oct 31, 2013, 10:31:15 AM10/31/13
to wicket-j...@googlegroups.com
everything is fine again with 6.11.1-SNAPSHOT.

except that I needed to add wicket-jquery-ui-core explicitly as a dependency to be able to build in IDEA ... :-/

 <dependency>
            <groupId>com.googlecode.wicket-jquery-ui</groupId>
            <artifactId>wicket-jquery-ui</artifactId>
            <version>${wicket.jqueryui.version}</version>
        </dependency>
        <dependency>
            <groupId>com.googlecode.wicket-jquery-ui</groupId>
            <artifactId>wicket-jquery-ui-core</artifactId>
            <version>${wicket.jqueryui.version}</version>
        </dependency>

Sebastien

unread,
Oct 31, 2013, 11:48:01 AM10/31/13
to wicket-j...@googlegroups.com
Hi Martin,

Thank you very much for your time!

Do we agree you clicked on the dialog's Ok button? (I mean, not the one labelled "Submit")
Can you also confirm the form instantiation is done in AjaxCommentDialog#onInitialize() rather than in the ctor? (should be the case actually)

When I click on the Ok button, I've got this
Dialog#onSubmit - comment: null

When I click the (normal-ajax-button) "Submit" button, I've got the text I entered

Same behavior using FF 24, Chrome 30.0 and.... IE8

Thanks again & best regards!
Sebastien.

Martin Grigorov

unread,
Oct 31, 2013, 1:14:35 PM10/31/13
to wicket-j...@googlegroups.com
On Thu, Oct 31, 2013 at 5:48 PM, Sebastien <seb...@gmail.com> wrote:
Hi Martin,

Thank you very much for your time!

Do we agree you clicked on the dialog's Ok button? (I mean, not the one labelled "Submit")

I used the Submit button.
 
Can you also confirm the form instantiation is done in AjaxCommentDialog#onInitialize() rather than in the ctor? (should be the case actually)

Yes. The form is instantiated in #onInitialize().
 

When I click on the Ok button, I've got this
Dialog#onSubmit - comment: null

Maybe OK button doesn't know about the Form.
 

When I click the (normal-ajax-button) "Submit" button, I've got the text I entered

Same behavior using FF 24, Chrome 30.0 and.... IE8

Thanks again & best regards!
Sebastien.

I'll try again next week. 

--
You received this message because you are subscribed to the Google Groups "wicket-jquery-ui" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wicket-jquery-...@googlegroups.com.

Martin Grigorov

unread,
Nov 4, 2013, 3:13:49 AM11/4/13
to wicket-j...@googlegroups.com
On Thu, Oct 31, 2013 at 7:14 PM, Martin Grigorov <martin....@gmail.com> wrote:



On Thu, Oct 31, 2013 at 5:48 PM, Sebastien <seb...@gmail.com> wrote:
Hi Martin,

Thank you very much for your time!

Do we agree you clicked on the dialog's Ok button? (I mean, not the one labelled "Submit")

I used the Submit button.
 
Can you also confirm the form instantiation is done in AjaxCommentDialog#onInitialize() rather than in the ctor? (should be the case actually)

Yes. The form is instantiated in #onInitialize().
 

When I click on the Ok button, I've got this
Dialog#onSubmit - comment: null

Maybe OK button doesn't know about the Form.

Yes. This is the problem.

wickettest.wickettest.AjaxCommentDialog:
@Override
protected void onInitialize()
{
// does not submit TextField's value if declared here!
this.form = new Form<Void>("form");
this.add(this.form);

super.onInitialize();

works OK. 

The real problem is com.googlecode.wicket.jquery.ui.widget.dialog.AbstractFormDialog#getForm(com.googlecode.wicket.jquery.ui.widget.dialog.DialogButton)
It is called because of "super.onInitialize();" from above and at that point the 'form' is still null, so OK_BUTTON doesn't know the form it should submit.

Sebastien

unread,
Nov 4, 2013, 4:06:49 AM11/4/13
to wicket-j...@googlegroups.com
Hi Martin,

Well done Martin!!! I cannot believe I did not see it!... :s

I was really not looking into this direction, I saw that the form was null after the submission but I did not imagine it could be null before....

I will try to find a way to correct this... But at a first glance, it seems that calling super.onInitialize(); after the instantiation is the only workaround... Also, maybe a Args.notNull somewhere could prevent this from happening... ;)

Thank you again very much,
Sebastien.

Reply all
Reply to author
Forward
0 new messages