You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Anantha Kumaran <an...@gmail.com> on 2010/01/03 10:19:01 UTC

AjaxSubmitLink not calling the onsubmit event handler

Is it possible to add a onsubmit event to a form that is submitted using
AjaxSubmitLink?

if not so is there any other way to handle validation stuffs..

Re: AjaxSubmitLink not calling the onsubmit event handler

Posted by Anantha Kumaran <an...@gmail.com>.
https://issues.apache.org/jira/browse/WICKET-2807

On Sat, Mar 27, 2010 at 11:50 AM, Igor Vaynberg <ig...@gmail.com>wrote:

> open an rfe
>
> -igor
>
> On Fri, Mar 26, 2010 at 11:12 PM, Richard Nichols <rn...@richardnichols.net>
> wrote:
> > 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 <an...@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 <an...@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.degraeuwe@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 <
> >>> ananthakumaran@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.programmer@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-unsubscribe@wicket.apache.org
> >>> >> > > For additional commands, e-mail: users-help@wicket.apache.org
> >>> >> > >
> >>> >> > >
> >>> >> >
> >>> >>
> >>> >>
> >>> >>
> >>> >> --
> >>> >> Pieter Degraeuwe
> >>> >> Systemworks bvba
> >>> >> Belgiëlaan 61
> >>> >> 9070 Destelbergen
> >>> >> GSM: +32 (0)485/68.60.85
> >>> >> Email: pieter.degraeuwe@systemworks.be
> >>> >> visit us at http://www.systemworks.be
> >>> >>
> >>> >
> >>>
> >>>
> >>>
> >>> --
> >>> Richard Nichols :: http://www.visural.com/ ::
> >>> http://www.richardnichols.net/
> >>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >>> For additional commands, e-mail: users-help@wicket.apache.org
> >>>
> >>>
> >>
> >>
> >> --
> >> ----
> >> Anantha Kumaran(http://ananthakumaran.github.com)
> >>
> >
> >
> >
> > --
> > Richard Nichols :: http://www.visural.com/ ::
> http://www.richardnichols.net/
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
----
Anantha Kumaran(http://ananthakumaran.github.com)

Re: AjaxSubmitLink not calling the onsubmit event handler

Posted by Igor Vaynberg <ig...@gmail.com>.
open an rfe

-igor

On Fri, Mar 26, 2010 at 11:12 PM, Richard Nichols <rn...@richardnichols.net> wrote:
> 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 <an...@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 <an...@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.degraeuwe@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 <
>>> ananthakumaran@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.programmer@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-unsubscribe@wicket.apache.org
>>> >> > > For additional commands, e-mail: users-help@wicket.apache.org
>>> >> > >
>>> >> > >
>>> >> >
>>> >>
>>> >>
>>> >>
>>> >> --
>>> >> Pieter Degraeuwe
>>> >> Systemworks bvba
>>> >> Belgiëlaan 61
>>> >> 9070 Destelbergen
>>> >> GSM: +32 (0)485/68.60.85
>>> >> Email: pieter.degraeuwe@systemworks.be
>>> >> visit us at http://www.systemworks.be
>>> >>
>>> >
>>>
>>>
>>>
>>> --
>>> Richard Nichols :: http://www.visural.com/ ::
>>> http://www.richardnichols.net/
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>
>>
>> --
>> ----
>> Anantha Kumaran(http://ananthakumaran.github.com)
>>
>
>
>
> --
> Richard Nichols :: http://www.visural.com/ :: http://www.richardnichols.net/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


Re: AjaxSubmitLink not calling the onsubmit event handler

Posted by Richard Nichols <rn...@richardnichols.net>.
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 <an...@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 <an...@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.degraeuwe@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 <
>> ananthakumaran@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.programmer@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-unsubscribe@wicket.apache.org
>> >> > > For additional commands, e-mail: users-help@wicket.apache.org
>> >> > >
>> >> > >
>> >> >
>> >>
>> >>
>> >>
>> >> --
>> >> Pieter Degraeuwe
>> >> Systemworks bvba
>> >> Belgiëlaan 61
>> >> 9070 Destelbergen
>> >> GSM: +32 (0)485/68.60.85
>> >> Email: pieter.degraeuwe@systemworks.be
>> >> visit us at http://www.systemworks.be
>> >>
>> >
>>
>>
>>
>> --
>> Richard Nichols :: http://www.visural.com/ ::
>> http://www.richardnichols.net/
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
>
> --
> ----
> Anantha Kumaran(http://ananthakumaran.github.com)
>



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

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


Re: AjaxSubmitLink not calling the onsubmit event handler

Posted by Anantha Kumaran <an...@gmail.com>.
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 <an...@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.degraeuwe@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 <
> ananthakumaran@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.programmer@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-unsubscribe@wicket.apache.org
> >> > > For additional commands, e-mail: users-help@wicket.apache.org
> >> > >
> >> > >
> >> >
> >>
> >>
> >>
> >> --
> >> Pieter Degraeuwe
> >> Systemworks bvba
> >> Belgiëlaan 61
> >> 9070 Destelbergen
> >> GSM: +32 (0)485/68.60.85
> >> Email: pieter.degraeuwe@systemworks.be
> >> visit us at http://www.systemworks.be
> >>
> >
>
>
>
> --
> Richard Nichols :: http://www.visural.com/ ::
> http://www.richardnichols.net/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
----
Anantha Kumaran(http://ananthakumaran.github.com)

Re: AjaxSubmitLink not calling the onsubmit event handler

Posted by Richard Nichols <rn...@richardnichols.net>.
Hi Anantha,

Did you get a resolution to this issue? I have the same problem.

Is this expected behavior I wonder, or a bug?

SubmitLink will call the <form>'s onsubmit='???' handler,
AjaxSubmitLink does not.


On 4 January 2010 23:05, Anantha Kumaran <an...@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.degraeuwe@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 <ananthakumaran@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.programmer@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-unsubscribe@wicket.apache.org
>> > > For additional commands, e-mail: users-help@wicket.apache.org
>> > >
>> > >
>> >
>>
>>
>>
>> --
>> Pieter Degraeuwe
>> Systemworks bvba
>> Belgiëlaan 61
>> 9070 Destelbergen
>> GSM: +32 (0)485/68.60.85
>> Email: pieter.degraeuwe@systemworks.be
>> visit us at http://www.systemworks.be
>>
>



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

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


Re: AjaxSubmitLink not calling the onsubmit event handler

Posted by Anantha Kumaran <an...@gmail.com>.
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.degraeuwe@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 <ananthakumaran@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.programmer@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-unsubscribe@wicket.apache.org
> > > For additional commands, e-mail: users-help@wicket.apache.org
> > >
> > >
> >
>
>
>
> --
> Pieter Degraeuwe
> Systemworks bvba
> Belgiëlaan 61
> 9070 Destelbergen
> GSM: +32 (0)485/68.60.85
> Email: pieter.degraeuwe@systemworks.be
> visit us at http://www.systemworks.be
>

Re: AjaxSubmitLink not calling the onsubmit event handler

Posted by Pieter Degraeuwe <pi...@systemworks.be>.
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 <an...@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.programmer@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-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>



-- 
Pieter Degraeuwe
Systemworks bvba
Belgiëlaan 61
9070 Destelbergen
GSM: +32 (0)485/68.60.85
Email: pieter.degraeuwe@systemworks.be
visit us at http://www.systemworks.be

Re: AjaxSubmitLink not calling the onsubmit event handler

Posted by Anantha Kumaran <an...@gmail.com>.
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.programmer@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-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: AjaxSubmitLink not calling the onsubmit event handler

Posted by Mathias Nilsson <wi...@gmail.com>.
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-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org