Jquery submit loads page

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Jquery submit loads page

NorbertHartl
Maybe I'm just too tired to get it straight. I have

html form with: [
        html submitButton
                onClick: (html jQuery ajax serializeForm );
                with: 'foo' ]

and if I click the button I get the ajax request and afterwards the page is loaded.

What could I've forgotten?

thanks,

Norbert_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Jquery submit loads page

Lukas Renggli
On 19 October 2011 18:08, Norbert Hartl <[hidden email]> wrote:

> Maybe I'm just too tired to get it straight. I have
>
> html form with: [
>        html submitButton
>                onClick: (html jQuery ajax serializeForm );
>                with: 'foo' ]
>
> and if I click the button I get the ajax request and afterwards the page is loaded.
>
> What could I've forgotten?

html form with: [
        html submitButton
               onClick: (html jQuery ajax serializeForm**; return: false**);
                with: 'foo' ]

Otherwise the #submitButton is triggered.

Lukas

>
> thanks,
>
> Norbert_______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>



--
Lukas Renggli
www.lukas-renggli.ch
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Jquery submit loads page

Paul DeBruicker
In reply to this post by NorbertHartl
On 11-10-19 09:08 AM, Norbert Hartl wrote:
> html form with: [
> html submitButton
> onClick: (html jQuery ajax serializeForm );
> with: 'foo' ]
Adding bePush would stop it from acting like a submit button, in the
traditional sense, but still style it like one and the form would still
be POSTed because of the jQuery you include.  IS that what you have in mind?


html form with: [
        html submitButton
                bePush;
                onClick: (html jQuery ajax serializeForm );
                with: 'foo' ]

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Jquery submit loads page

NorbertHartl
In reply to this post by Lukas Renggli

Am 19.10.2011 um 18:10 schrieb Lukas Renggli:

> On 19 October 2011 18:08, Norbert Hartl <[hidden email]> wrote:
>> Maybe I'm just too tired to get it straight. I have
>>
>> html form with: [
>>        html submitButton
>>                onClick: (html jQuery ajax serializeForm );
>>                with: 'foo' ]
>>
>> and if I click the button I get the ajax request and afterwards the page is loaded.
>>
>> What could I've forgotten?
>
> html form with: [
>        html submitButton
>                onClick: (html jQuery ajax serializeForm**; return: false**);
>                with: 'foo' ]
>
> Otherwise the #submitButton is triggered.

great, thanks,

Norbert

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Jquery submit loads page

NorbertHartl
In reply to this post by Paul DeBruicker

Am 19.10.2011 um 18:11 schrieb Paul DeBruicker:

> On 11-10-19 09:08 AM, Norbert Hartl wrote:
>> html form with: [
>> html submitButton
>> onClick: (html jQuery ajax serializeForm );
>> with: 'foo' ]
> Adding bePush would stop it from acting like a submit button, in the traditional sense, but still style it like one and the form would still be POSTed because of the jQuery you include.  IS that what you have in mind?
>
>
> html form with: [
> html submitButton
> bePush;
> onClick: (html jQuery ajax serializeForm );
> with: 'foo' ]

No, I tried this myself but got the same behaviour on submitButton and button. Both alternatives triggered a page load. With Lukas' fix it works: submitting the form without reloading the page.

Norbert

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Jquery submit loads page

Dave
In reply to this post by NorbertHartl
Hi Norbert,
 I resumed this old thread because I faced the same issue (i.e. the form posted twice).

Lukas' solution is right, but if we change the submit button with an anchor we can avoid the double submission and I think it is more clear than "return false"

Here is my example:

html form with: [
                 html anchor onClick:(html jQuery ajax serializeForm);
                with: 'foo' ]

Dave