[Seaside] capture client events in seaside?

Robert Sirois watchlala at hotmail.com
Tue Sep 13 14:51:48 UTC 2011


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: nick.ager at gmail.com
To: seaside at lists.squeakfoundation.org

| 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 <ljw1001 at gmail.com> 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 <milan.mimica at gmail.com> wrote:


html select list

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





On 11 September 2011 20:39, Larry White <ljw1001 at gmail.com> 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

> seaside at lists.squeakfoundation.org

> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

>

>







--

Milan Mimica

http://sparklet.sf.net

_______________________________________________

seaside mailing list

seaside at lists.squeakfoundation.org

http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside




_______________________________________________

seaside mailing list

seaside at lists.squeakfoundation.org

http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside





_______________________________________________
seaside mailing list
seaside at lists.squeakfoundation.org
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20110913/a7f2c9ae/attachment-0001.htm


More information about the seaside mailing list