Hi,
i need to read two parameters ( width @ height ) relative to a DIV element. For now i use this declarations: html div class: 'topSide'; " read width " onClick: (html jQuery ajax callback: [ :x | x inspect ] value: (html jQuery this width)). "raed height " onClick: (html jQuery ajax callback: [ :x | x inspect ] value: (html jQuery this height)). Now my question is: i can read the two values with only one declaration? How i can define the value: ( html jQuery this width................ '@' ............... html jQuery this height ) for concatenated the two values and return a string in form of string Point: '200@400' I declared : value: ( html jQuery this width, '@' , html jQuery this height ) but it don't work. Considerations? Thanks, Dario_______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
You will need to construct a valid javascript expression in the argument passed after #value:.
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}') Hope this helps Johan On 04 Jan 2014, at 17:03, [hidden email] wrote: > Hi, > > i need to read two parameters ( width @ height ) relative to a DIV element. > > For now i use this declarations: > > > html div class: 'topSide'; > " read width " > onClick: (html jQuery ajax > callback: [ :x | x inspect ] > value: (html jQuery this width)). > > "raed height " > onClick: (html jQuery ajax > callback: [ :x | x inspect ] > value: (html jQuery this height)). > > > Now my question is: > > i can read the two values with only one declaration? > > How i can define the value: ( html jQuery this width................ '@' ............... html jQuery this height ) > > > for concatenated the two values and return a string in form of string Point: '200@400' > > > I declared : value: ( html jQuery this width, '@' , html jQuery this height ) > > but it don't work. > > Considerations? > > > Thanks, > > Dario_______________________________________________ > 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 |
Thank Johan,
> 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 ? > 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. Ciao, Dario > Hope this helps > Johan > > On 04 Jan 2014, at 17:03, [hidden email] wrote: > >> Hi, >> >> i need to read two parameters ( width @ height ) relative to a DIV element. >> >> For now i use this declarations: >> >> >> html div class: 'topSide'; >> " read width " >> onClick: (html jQuery ajax >> callback: [ :x | x inspect ] >> value: (html jQuery this width)). >> >> "raed height " >> onClick: (html jQuery ajax >> callback: [ :x | x inspect ] >> value: (html jQuery this height)). >> >> >> Now my question is: >> >> i can read the two values with only one declaration? >> >> How i can define the value: ( html jQuery this width................ '@' ............... html jQuery this height ) >> >> >> for concatenated the two values and return a string in form of string Point: '200@400' >> >> >> I declared : value: ( html jQuery this width, '@' , html jQuery this height ) >> >> but it don't work. >> >> Considerations? >> >> >> Thanks, >> >> Dario_______________________________________________ >> 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 |
In reply to this post by dtrussardi@tiscali.it
I use this in an onClick:
html jQuery ajax callback: [ :value | p _ value findTokens: ' '. p _ p first asNumber @ p second asNumber. ] value: (JSStream on: 'arguments[0].pageX+" "+arguments[0].pageY') Cheers, Bob On 1/4/14 11:03 AM,
[hidden email] wrote:
Hi, i need to read two parameters ( width @ height ) relative to a DIV element. For now i use this declarations: html div class: 'topSide'; " read width " onClick: (html jQuery ajax callback: [ :x | x inspect ] value: (html jQuery this width)). "raed height " onClick: (html jQuery ajax callback: [ :x | x inspect ] value: (html jQuery this height)). Now my question is: i can read the two values with only one declaration? How i can define the value: ( html jQuery this width................ '@' ............... html jQuery this height ) for concatenated the two values and return a string in form of string Point: '200@400' I declared : value: ( html jQuery this width, '@' , html jQuery this height ) but it don't work. Considerations? Thanks, Dario_______________________________________________ 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 |
In reply to this post by dtrussardi@tiscali.it
On 04 Jan 2014, at 18:06, [hidden email] 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 ? Johan_______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
> > On 04 Jan 2014, at 18:06, [hidden email] 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 ? > onDoubleClick: (html jQuery ajax callback: [ :dict | dict inspect ] json: (JSStream on: '{ "width": $(this).width(), "height": $(this).height()}') work fine; and this too: onDoubleClick: (html jQuery ajax callback: [ :x | x inspect ] value: (JSStream on: '$(this).width()+" "+$(this).height()' )); Thank, Dario _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Free forum by Nabble | Edit this page |