capture client events in seaside?

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

capture client events in seaside?

larrry
Hi what is the best way to capture a client-side event in seaside?

I have a menu that includes a select box. I would like to capture the select event so that I can update a view when the selection changes.  

html select  list: (Dao new) allProducts;
            callback: [ :value |  
productEntryAction value].

I guess I could wrap it in a form and put a 'go' submitButton next to it, but that seems so 2004 ;)  Is there anything better?



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

Re: capture client events in seaside?

mmimica
html select list
  onChange: (html jQuery ajax callback: [ do your stuff here ]).


On 11 September 2011 20:39, Larry White <[hidden email]> wrote:

> Hi what is the best way to capture a client-side event in seaside?
> I have a menu that includes a select box. I would like to capture the select
> event so that I can update a view when the selection changes.
> html select  list: (Dao new) allProducts;
>             callback: [ :value |
> productEntryAction value].
> I guess I could wrap it in a form and put a 'go' submitButton next to it,
> but that seems so 2004 ;)  Is there anything better?
>
>
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>



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

Re: capture client events in seaside?

larrry
thanks. I had a feeling it involved jquery or javascript; This looks much scary than I was expecting. ;)

On Sun, Sep 11, 2011 at 2:46 PM, Milan Mimica <[hidden email]> wrote:
html select list
 onChange: (html jQuery ajax callback: [ do your stuff here ]).


On 11 September 2011 20:39, Larry White <[hidden email]> wrote:
> Hi what is the best way to capture a client-side event in seaside?
> I have a menu that includes a select box. I would like to capture the select
> event so that I can update a view when the selection changes.
> html select  list: (Dao new) allProducts;
>             callback: [ :value |
> productEntryAction value].
> I guess I could wrap it in a form and put a 'go' submitButton next to it,
> but that seems so 2004 ;)  Is there anything better?
>
>
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>



--
Milan Mimica
http://sparklet.sf.net
_______________________________________________
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: capture client events in seaside?

larrry
In reply to this post by mmimica
hmm. I tried your suggestion and it's almost working, but I don't see how to get the current selection value back.  If I replace the [do your stuff here] block with one that accepts an argument, like [:val | doSomethingWIth: val] I get an exception stating that the block wants an argument, but it's not being called with one. 

I tried to use html select callback: to get the selected value (this seems to be what the example on the Jquery/seaside web pages show), but it never gets invoked:

html select 
list: Dao new allProducts;
selected: currentProduct;
            callback: [ :value | currentProduct := value ];
  onChange: (html jQuery ajax callback: [ 
productEntryAction value: currentProduct]).

Any other suggestions would be appreciated. Thanks again.


On Sun, Sep 11, 2011 at 2:46 PM, Milan Mimica <[hidden email]> wrote:
html select list
 onChange: (html jQuery ajax callback: [ do your stuff here ]).


On 11 September 2011 20:39, Larry White <[hidden email]> wrote:
> Hi what is the best way to capture a client-side event in seaside?
> I have a menu that includes a select box. I would like to capture the select
> event so that I can update a view when the selection changes.
> html select  list: (Dao new) allProducts;
>             callback: [ :value |
> productEntryAction value].
> I guess I could wrap it in a form and put a 'go' submitButton next to it,
> but that seems so 2004 ;)  Is there anything better?
>
>
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>



--
Milan Mimica
http://sparklet.sf.net
_______________________________________________
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: capture client events in seaside?

Nick
| selectId |

You could try something like (untested):

html select 
        id: (selectId := html nextId);
list: Dao new allProducts;
selected: currentProduct;
        callback: [ :value | currentProduct := value ];
  onChange: (html jQuery ajax script: [ :s | 
s << "render updates here"]; serialize: (html jQuery id: selectId))


On 13 September 2011 14:18, Larry White <[hidden email]> wrote:
hmm. I tried your suggestion and it's almost working, but I don't see how to get the current selection value back.  If I replace the [do your stuff here] block with one that accepts an argument, like [:val | doSomethingWIth: val] I get an exception stating that the block wants an argument, but it's not being called with one. 

I tried to use html select callback: to get the selected value (this seems to be what the example on the Jquery/seaside web pages show), but it never gets invoked:

html select 
list: Dao new allProducts;
selected: currentProduct;
            callback: [ :value | currentProduct := value ];
  onChange: (html jQuery ajax callback: [ 
productEntryAction value: currentProduct]).

Any other suggestions would be appreciated. Thanks again.


On Sun, Sep 11, 2011 at 2:46 PM, Milan Mimica <[hidden email]> wrote:
html select list
 onChange: (html jQuery ajax callback: [ do your stuff here ]).


On 11 September 2011 20:39, Larry White <[hidden email]> wrote:
> Hi what is the best way to capture a client-side event in seaside?
> I have a menu that includes a select box. I would like to capture the select
> event so that I can update a view when the selection changes.
> html select  list: (Dao new) allProducts;
>             callback: [ :value |
> productEntryAction value].
> I guess I could wrap it in a form and put a 'go' submitButton next to it,
> but that seems so 2004 ;)  Is there anything better?
>
>
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>



--
Milan Mimica
http://sparklet.sf.net
_______________________________________________
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



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

RE: capture client events in seaside?

Robert Sirois
The callback won't be executed until the select element is serialized (either via ajax or submission), so in order to get the currently selected value, you will need to serialize first.

RS


Date: Tue, 13 Sep 2011 14:32:02 +0100
Subject: Re: [Seaside] capture client events in seaside?
From: [hidden email]
To: [hidden email]

| selectId |

You could try something like (untested):

html select 
        id: (selectId := html nextId);
list: Dao new allProducts;
selected: currentProduct;
        callback: [ :value | currentProduct := value ];
  onChange: (html jQuery ajax script: [ :s | 
s << "render updates here"]; serialize: (html jQuery id: selectId))


On 13 September 2011 14:18, Larry White <[hidden email]> wrote:
hmm. I tried your suggestion and it's almost working, but I don't see how to get the current selection value back.  If I replace the [do your stuff here] block with one that accepts an argument, like [:val | doSomethingWIth: val] I get an exception stating that the block wants an argument, but it's not being called with one. 

I tried to use html select callback: to get the selected value (this seems to be what the example on the Jquery/seaside web pages show), but it never gets invoked:

html select 
list: Dao new allProducts;
selected: currentProduct;
            callback: [ :value | currentProduct := value ];
  onChange: (html jQuery ajax callback: [ 
productEntryAction value: currentProduct]).

Any other suggestions would be appreciated. Thanks again.


On Sun, Sep 11, 2011 at 2:46 PM, Milan Mimica <[hidden email]> wrote:
html select list
 onChange: (html jQuery ajax callback: [ do your stuff here ]).


On 11 September 2011 20:39, Larry White <[hidden email]> wrote:
> Hi what is the best way to capture a client-side event in seaside?
> I have a menu that includes a select box. I would like to capture the select
> event so that I can update a view when the selection changes.
> html select  list: (Dao new) allProducts;
>             callback: [ :value |
> productEntryAction value].
> I guess I could wrap it in a form and put a 'go' submitButton next to it,
> but that seems so 2004 ;)  Is there anything better?
>
>
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>



--
Milan Mimica
http://sparklet.sf.net
_______________________________________________
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



_______________________________________________ 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: capture client events in seaside?

larrry
There's a very nice, but deprecated, method on WASelectTag called beSubmitOnChange that does exactly what I wanted.  Having to explicitly serialize the selected text and lookup the text on the server seems like a tiny step backwards. 


On Tue, Sep 13, 2011 at 10:51 AM, Robert Sirois <[hidden email]> wrote:
The callback won't be executed until the select element is serialized (either via ajax or submission), so in order to get the currently selected value, you will need to serialize first.

RS


Date: Tue, 13 Sep 2011 14:32:02 +0100
Subject: Re: [Seaside] capture client events in seaside?
From: [hidden email]
To: [hidden email]


| selectId |

You could try something like (untested):

html select 
        id: (selectId := html nextId);
list: Dao new allProducts;
selected: currentProduct;
        callback: [ :value | currentProduct := value ];
  onChange: (html jQuery ajax script: [ :s | 
s << "render updates here"]; serialize: (html jQuery id: selectId))


On 13 September 2011 14:18, Larry White <[hidden email]> wrote:
hmm. I tried your suggestion and it's almost working, but I don't see how to get the current selection value back.  If I replace the [do your stuff here] block with one that accepts an argument, like [:val | doSomethingWIth: val] I get an exception stating that the block wants an argument, but it's not being called with one. 

I tried to use html select callback: to get the selected value (this seems to be what the example on the Jquery/seaside web pages show), but it never gets invoked:

html select 
list: Dao new allProducts;
selected: currentProduct;
            callback: [ :value | currentProduct := value ];
  onChange: (html jQuery ajax callback: [ 
productEntryAction value: currentProduct]).

Any other suggestions would be appreciated. Thanks again.


On Sun, Sep 11, 2011 at 2:46 PM, Milan Mimica <[hidden email]> wrote:
html select list
 onChange: (html jQuery ajax callback: [ do your stuff here ]).


On 11 September 2011 20:39, Larry White <[hidden email]> wrote:
> Hi what is the best way to capture a client-side event in seaside?
> I have a menu that includes a select box. I would like to capture the select
> event so that I can update a view when the selection changes.
> html select  list: (Dao new) allProducts;
>             callback: [ :value |
> productEntryAction value].
> I guess I could wrap it in a form and put a 'go' submitButton next to it,
> but that seems so 2004 ;)  Is there anything better?
>
>
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>



--
Milan Mimica
http://sparklet.sf.net
_______________________________________________
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



_______________________________________________ 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



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