Anchor with submit and callback

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

Anchor with submit and callback

Carl Gundel
When I use the code below the anchor submits, but it doesn't execute the
callback.  If I eliminate the submitFormNamed: then clicking executes the
callback, but of course then it doesn't submit the form.  Is it possible to
have an anchor that does both?

 html anchor
    id: 'cssID';
    submitFormNamed: 'submitMe';
    callback: [self doSomething];
    text: 'Do something'.

-Carl Gundel, author of Liberty BASIC
http://www.libertybasic.com 


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

Re: Anchor with submit and callback

Philippe Marschall
What you want is a submitButton. It has a callback and submitts a form.

Philippe

2006/11/16, Carl Gundel <[hidden email]>:

> When I use the code below the anchor submits, but it doesn't execute the
> callback.  If I eliminate the submitFormNamed: then clicking executes the
> callback, but of course then it doesn't submit the form.  Is it possible to
> have an anchor that does both?
>
>  html anchor
>     id: 'cssID';
>     submitFormNamed: 'submitMe';
>     callback: [self doSomething];
>     text: 'Do something'.
>
> -Carl Gundel, author of Liberty BASIC
> http://www.libertybasic.com
>
>
> _______________________________________________
> Seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Anchor with submit and callback

Carl Gundel
>From: "Philippe Marschall" <[hidden email]>
>> 2006/11/16, Carl Gundel <[hidden email]>:
>> When I use the code below the anchor submits, but it doesn't execute the
>> callback.  If I eliminate the submitFormNamed: then clicking executes the
>> callback, but of course then it doesn't submit the form.  Is it possible
>> to
>> have an anchor that does both?

> What you want is a submitButton. It has a callback and submitts a form.

I should have known the answer, but I keep looking for a way to support
multiple actions on a form without resorting to checkboxes or selections.
Is this simply not possible the way web browsers and HTTP work, or is it
possible to extend Seaside to make it work?

Thanks,

-Carl Gundel, author of Liberty BASIC
http://www.libertybasic.com 


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

Re: Re: Anchor with submit and callback

Lukas Renggli
> I should have known the answer, but I keep looking for a way to support
> multiple actions on a form without resorting to checkboxes or selections.
> Is this simply not possible the way web browsers and HTTP work, or is it
> possible to extend Seaside to make it work?

Yes, use AJAX. Have a look at the included examples of the
Scriptaculous package and the various posts in this group about the
framework.

Lukas

--
Lukas Renggli
http://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: Anchor with submit and callback

Michel Bany-3
In reply to this post by Carl Gundel
Carl Gundel a écrit :

> When I use the code below the anchor submits, but it doesn't execute
> the callback.  If I eliminate the submitFormNamed: then clicking
> executes the callback, but of course then it doesn't submit the form.  
> Is it possible to have an anchor that does both?
>
> html anchor
>    id: 'cssID';
>    submitFormNamed: 'submitMe';
>    callback: [self doSomething];
>    text: 'Do something'.
Hi Carl,

This is very strange because WACanvasLinkSubmitTest is doing
exactly what you are trying to accomplish. This can be seen
at http://localhost:8008/seaside/go/tests/allcanvastests
where you select tab entitled "Submit"

Enter (say) 23 in the input field then click the "++" link, you
should get a value of 24 demonstrating that the form
was indeed submitted with all the callbacks executed.

The only difference I see is the order of the message sends,
and I believe this is important so that the javascript created
by #handlerForForm: also includes the callback key that has
been created earlier by the #callback: message

            html anchor
                id: #increaseLink;
                addShortcut: 'Ctrl-Up';
                callback: [count := count + 1];
                submitFormNamed: formId;
                text: '++'.

HTH
Michel.


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

Re: Re: Anchor with submit and callback

Carl Gundel
In reply to this post by Lukas Renggli
>Carl Gundel a écrit :
>> When I use the code below the anchor submits, but it doesn't execute the
>> callback.  If I eliminate the submitFormNamed: then clicking executes the
>> callback, but of course then it doesn't submit the form.  Is it possible
>> to have an anchor that does both?
>
>This is very strange because WACanvasLinkSubmitTest is doing
>exactly what you are trying to accomplish. This can be seen
>at http://localhost:8008/seaside/go/tests/allcanvastests
>where you select tab entitled "Submit"
>...
>The only difference I see is the order of the message sends,
>and I believe this is important so that the javascript created
>by #handlerForForm: also includes the callback key that has
>been created earlier by the #callback: message
>
>            html anchor
>                id: #increaseLink;
>                addShortcut: 'Ctrl-Up';
>                callback: [count := count + 1];
>                submitFormNamed: formId;
>                text: '++'.

Wow, that does seem to fix the problem.  Amazing.  I've got to make sure I
write this down.  :-)

Thanks!

-Carl Gundel, author of Liberty BASIC
http://www.libertybasic.com 


_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside