[Seaside] Read two values ( width @ height ) with only one declaration

Johan Brichau johan at inceptive.be
Sat Jan 4 17:52:30 UTC 2014

On 04 Jan 2014, at 18:06, dtrussardi at tiscali.it wrote:

>> You will need to construct a valid javascript expression in the argument passed after #value:.
> 	i do some attempts but i don't find the right solution.
> 	In my smalltalk image i don't find a valid example how i can concatenate two value with a separator.
> 	Any reference ?

Bob's example is a good one.
Keep in mind you can only transfer strings from the client to the server and that it needs to be Javascript.
So, my best advice is that you check out Javascript manuals because you are trying to do more things on the client. Even if you use the Seaside wrappers, you still need to know what Javascript expression you are eventually creating.

>> Alternatively, try using the #callback:json: method to transfer multiple values:
>> (html jQuery ajax
>> 	callback: [ :dict | dict inspect ]
>>  	json: (JSStream on: '{ "width": $(this).width, "height": $(this).height}')
> 	I test this but the	 dict inspect   return an empty dictionary.
> 	I add the		 anHtmlRoot javascript 
> 						url: JSJsonDeploymentLibrary / #json2Js
> 	but with Safari  and Firefox don't work.

Hm... you don't need that library to be able to use JSON.
I don't know what might be wrong with the expression above. My code is full of that stuff.

btw, width and height are functions in jQuery... did you try:

$(this).width() instead of $(this).width   ?


More information about the seaside mailing list