Yeah, maybe one of the wicket devs could comment on whether this is
expected behaviour?

In any case, I have built a workaround as part of my open source
http://code.google.com/p/visural-wicket/ project.

See - 
http://code.google.com/p/visural-wicket/source/browse/trunk/visural-wicket/src/com/visural/wicket/util/InvokeClientSideFormSubmitHandlerDecorator.java

This AjaxCallDecorator will invoke the form's onsubmit handler prior
to invoking the ajax call.

So you can:

add(new AjaxSubmitLink("blah") {
        @Override
        protected IAjaxCallDecorator getAjaxCallDecorator() {
            return new InvokeClientSideFormSubmitHandlerDecorator(MyForm.this);
        }
});

And have any ajax submission work the same as SubmitLink / SubmitButton.

On 26 March 2010 19:51, Anantha Kumaran <ananthakuma...@gmail.com> wrote:
> Did you get a resolution to this issue? I have the same problem.
>
>
>        currently i am using this techniques to do the my stuff.But it
> breaks when the user press return key.
>
>              // save this so we can call it later
> var wicketOnClick = ajaxSubmitLink.onclick;
> ajaxSubmitLink.onclick = function() {
>                         // do your stuff
>  return wicketOnClick();
> };
>
> Is this expected behavior I wonder, or a bug?
>
>>
>> SubmitLink will call the <form>'s onsubmit='???' handler,
>> AjaxSubmitLink does not.
>>
>>
> AFAIK AjaxSubmitLink doesn't fire the submit event. Is serializes the form
> data and then makes a post call. I guess this
>  can't be fixed easily because wicket is using *inline event registration
> model*.
>
>
>
>
>> On 4 January 2010 23:05, Anantha Kumaran <ananthakuma...@gmail.com> wrote:
>> > hi pieter
>> >
>> > my problem is that the AjaxSubmitLink is not behaving like the SubmitLink
>> > which calls the onsubmit before submitting
>> > the form.currently i am using the mousedown(can't use onclick) of the
>> > AjaxSubmitLink to do the validation stuffs but it breaks when the user
>> > submit the form by pressing the return.
>> >
>> >
>> >
>> >
>> > On Mon, Jan 4, 2010 at 12:03 AM, Pieter Degraeuwe <
>> > pieter.degrae...@systemworks.be> wrote:
>> >
>> >> If you want to do some additional stuff, you can do it in the form a a
>> >> Behaviour.. I did use such behaviour to ask a javascript confirm. If
>> user
>> >> does not confirm, the form is not submitted.
>> >>
>> >> new AttributeModifier("onclick", true, new Model<String>("if
>> (!confirm('" +
>> >> msg + "')) { /* do some additional stuff if not confirmed*/return;} else
>> {
>> >> /*do some stuff beform submitting the form*/}")) {
>> >>           �...@override
>> >>            protected String newValue(String currentValue, String
>> >> replacementValue) {
>> >>                return replacementValue + currentValue;
>> >>            }
>> >>        };
>> >>
>> >> On Mon, Jan 4, 2010 at 5:30 AM, Anantha Kumaran <
>> ananthakuma...@gmail.com
>> >> >wrote:
>> >>
>> >> > is there any way to do this on the client side.I want to do some
>> client
>> >> > side
>> >> > stuff before submitting the form.
>> >> >
>> >> > On Sun, Jan 3, 2010 at 9:36 AM, Mathias Nilsson <
>> >> > wicket.program...@gmail.com
>> >> > > wrote:
>> >> >
>> >> > >
>> >> > > form.add ( new AjaxSubmitLink(){
>> >> > >
>> >> > > protected void onSubmit(AjaxRequestTarget target, Form form){
>> >> > >   // Add  feedback and do ajax stuff.
>> >> > > }
>> >> > >
>> >> > > protected void onError(AjaxRequestTarget target, Form form){
>> >> > >   // Add FeedbackPanel here
>> >> > >   target.add( feedback );
>> >> > > }});
>> >> > > --
>> >> > > View this message in context:
>> >> > >
>> >> >
>> >>
>> http://old.nabble.com/AjaxSubmitLink-not-calling-the-onsubmit-event-handler-tp27000018p27002962.html
>> >> > > Sent from the Wicket - User mailing list archive at Nabble.com.
>> >> > >
>> >> > >
>> >> > >
>> ---------------------------------------------------------------------
>> >> > > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> >> > > For additional commands, e-mail: users-h...@wicket.apache.org
>> >> > >
>> >> > >
>> >> >
>> >>
>> >>
>> >>
>> >> --
>> >> Pieter Degraeuwe
>> >> Systemworks bvba
>> >> Belgiëlaan 61
>> >> 9070 Destelbergen
>> >> GSM: +32 (0)485/68.60.85
>> >> Email: pieter.degrae...@systemworks.be
>> >> visit us at http://www.systemworks.be
>> >>
>> >
>>
>>
>>
>> --
>> Richard Nichols :: http://www.visural.com/ ::
>> http://www.richardnichols.net/
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
>
>
> --
> ----
> Anantha Kumaran(http://ananthakumaran.github.com)
>



-- 
Richard Nichols :: http://www.visural.com/ :: http://www.richardnichols.net/

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to