Button w/ liveCallback for Canvas API?

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

Button w/ liveCallback for Canvas API?

Rick Flower
Is there such a thing as a button that has a liveCallback associated
with it?
I was thinking of using a submit button but when this button is to be
pressed I only
want a livecallback event associated with it which would update the
contents of a
div with stuff -- kinda like adding an item to a shopping cart..  I
tried using a
liveCallback on a submit button and it complained.. Is there some other
button
available that is capable of a liveCallback or is my only option to use
the regular
callback: method?

Thanks!

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

RE: Button w/ liveCallback for Canvas API?

Bany, Michel
> Is there such a thing as a button that has a liveCallback
> associated with it?

Hi Rick,
This is still to be done. I hope to have something ready soon.

> I was thinking of using a submit button but when this button
> is to be pressed I only want a livecallback event associated
> with it which would update the contents of a div with stuff
> -- kinda like adding an item to a shopping cart..  I tried
> using a liveCallback on a submit button and it complained..
> Is there some other button available that is capable of a
> liveCallback or is my only option to use the regular
> callback: method?

Meanwhile, you may want to use an anchor element.

html anchor liveCallback: [:h | ...]; with: 'Click me'.
very close to
html submitButton liveCallback: [:h | ...]; text: 'Click me'.

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

Re: Button w/ liveCallback for Canvas API?

Lukas Renggli
> Meanwhile, you may want to use an anchor element.
>
> html anchor liveCallback: [:h | ...]; with: 'Click me'.
> very close to
> html submitButton liveCallback: [:h | ...]; text: 'Click me'.

Or use Scriptaculous. It decouples the brush (XHTML tag) and the
JavaScript action to take. So you can either write:

html anchor
   onClick: (html update
      id: 'foo';
      callback: [ :r | ... ]);
   with: 'Click me'

or

html submitButton
   onClick: (html update
      id: 'foo';
      callback: [ :r | ... ]);
   with: 'Click me'

or even

html div
   onClick: (html update
      id: 'foo';
      callback: [ :r | ... ]);
   with: 'Click me'

for a clickable div-element. Moreover you could well replace the
onClick action with something completely different, like hiding an
element or starting an animation effect.

Cheers,
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: Button w/ liveCallback for Canvas API?

Rick Flower
In reply to this post by Bany, Michel
Bany, Michel wrote:
> Meanwhile, you may want to use an anchor element.
>
> html anchor liveCallback: [:h | ...]; with: 'Click me'.
> very close to
> html submitButton liveCallback: [:h | ...]; text: 'Click me'.
>  
Hmm.. I'm assuming I can't have two submit buttons for the same form --
correct?
What I'm working on is a sort of shopping cart -- and this button I'm
looking for is
for the "add-to-cart" button which is why I wasn't really after a true
submit until
the end of the form when you submit the entire cart contents for further
processing
on the server side.  I think a anchor will probably work just fine but
will probably
just have a different look which of course isn't as important as having
it work
properly!  Thanks both of you for the info..   I'll probably pass on the
Scriptaculous
stuff since I don't want to mix or switch my existing async code over to
that
different framework (unless the async stuff is to be deprecated at some
point or
similar).  Anyway, thanks again!

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

RE: Button w/ liveCallback for Canvas API?

Bany, Michel
 

> Hmm.. I'm assuming I can't have two submit buttons for the
> same form -- correct?

I believe that you may have as many submit buttons as you like in a
form.

> What I'm working on is a sort of shopping cart -- and this
> button I'm looking for is for the "add-to-cart" button which
> is why I wasn't really after a true submit until the end of
> the form when you submit the entire cart contents for further
> processing on the server side.  I think a anchor will
> probably work just fine but will probably just have a
> different look which of course isn't as important as having it work
> properly!  Thanks both of you for the info..   I'll probably pass
> on the Scriptaculou stuff since I don't want to mix or switch my
> existing async  code over to that different framework (unless the
> async stuff is to be deprecated at some point or similar).  Anyway,
> thanks again!

In any event, I just published a new version of SeasideAsync that
provides live callbacks on submit buttons.

html submitButton
        callback: [3 zork "not evaluated"];
        onClick: ' ... this javascript is executed ...';
        liveCallback: [:r | ... ];
        onClick: ' ... too late, this javascript is not executed ...';
        text: 'Push me'.

If you decide to use it. I'll be happy to fix any remaining bug(s).
Since I have customers using SeasideAsync, this thing has to work.
However, in the long term, it may be easier to re-implement SeasideAsync
as a compatibility layer on top of Scriptaculous.

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: Button w/ liveCallback for Canvas API?

Rick Flower
Bany, Michel wrote:

> In any event, I just published a new version of SeasideAsync that
> provides live callbacks on submit buttons.
>
> html submitButton
> callback: [3 zork "not evaluated"];
> onClick: ' ... this javascript is executed ...';
> liveCallback: [:r | ... ];
> onClick: ' ... too late, this javascript is not executed ...';
> text: 'Push me'.
>
> If you decide to use it. I'll be happy to fix any remaining bug(s).
>  
Cool.. I will give it a try.. Thanks much!  I'll let you know how it
works regardless.

> Since I have customers using SeasideAsync, this thing has to work.
> However, in the long term, it may be easier to re-implement SeasideAsync
> as a compatibility layer on top of Scriptaculous.
>  
Sounds good.. As long as I don't have to reimplement everything that
would be great.. However,
the calling structure isn't too far from each other for the most part,
so perhaps moving between Async
and Scriptaculous isn't that bad.. (not that I've tried)..

Thanks again..

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

Re: Button w/ liveCallback for Canvas API?

Rick Flower
Rick Flower wrote:
> Cool.. I will give it a try.. Thanks much!  I'll let you know how it
> works regardless.
Ok.. It works as advertised.. Thanks again Michel!

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