I need to chain some calls I do with Ajax. I found
the onComplete:, onSuccess: etc. handlers. Every example I've found in the image uses them to invoke an html updater. Trying to do this ... onClick: ( html updater callback: []; onComplete: 'alert("booo!");' ); with: 'something'. leads to javascript code like new Ajax.Updater('layers','http://localhost:9090/seaside/svgex',{'insertion':Insertion.Bottom,'onSuccess':function(){'alert("boo!");'},'evalScripts':true,'parameters':['_s=EagyxUvvWRPxlAdD','_k=K3OXE7pw','4'].join('&')}) The problem is that to javascript code is printed with surrounding ticks ' and therefor cannot be executed. Am I doing something wrong or should be work that way? thanks, Norbert _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
The empty callback "makes noise in my hears". Try making it to be either a void
callback with the onClick defined or a useful callback without onClick but not the mix, cheers, Sebastian > -----Mensaje original----- > De: [hidden email] > [mailto:[hidden email]] En nombre > de Norbert Hartl > Enviado el: Martes, 22 de Julio de 2008 09:22 > Para: Seaside Mailing-List > Asunto: [Seaside] Bug? calling javascript function from onComplete: > > I need to chain some calls I do with Ajax. I found > the onComplete:, onSuccess: etc. handlers. Every example > I've found in the image uses them to invoke an html updater. > > Trying to do this > > ... > onClick: ( > html updater > callback: []; > onComplete: 'alert("booo!");' > ); > with: 'something'. > > leads to javascript code like > > new > Ajax.Updater('layers','http://localhost:9090/seaside/svgex',{' > insertion':Insertion.Bottom,'onSuccess':function(){'alert("boo > !");'},'evalScripts':true,'parameters':['_s=EagyxUvvWRPxlAdD', > '_k=K3OXE7pw','4'].join('&')}) > > The problem is that to javascript code is printed with surrounding > ticks ' and therefor cannot be executed. > > Am I doing something wrong or should be work that way? > > thanks, > > Norbert > > > _______________________________________________ > 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 |
On Tue, 2008-07-22 at 09:37 -0300, Sebastian Sastre wrote:
> The empty callback "makes noise in my hears". Try making it to be either a void > callback with the onClick defined or a useful callback without onClick but not > the mix, > That is an example!! The callback is not empty but the content doesn't matter here ;) Norbert > cheers, > > Sebastian > > > > > -----Mensaje original----- > > De: [hidden email] > > [mailto:[hidden email]] En nombre > > de Norbert Hartl > > Enviado el: Martes, 22 de Julio de 2008 09:22 > > Para: Seaside Mailing-List > > Asunto: [Seaside] Bug? calling javascript function from onComplete: > > > > I need to chain some calls I do with Ajax. I found > > the onComplete:, onSuccess: etc. handlers. Every example > > I've found in the image uses them to invoke an html updater. > > > > Trying to do this > > > > ... > > onClick: ( > > html updater > > callback: []; > > onComplete: 'alert("booo!");' > > ); > > with: 'something'. > > > > leads to javascript code like > > > > new > > Ajax.Updater('layers','http://localhost:9090/seaside/svgex',{' > > insertion':Insertion.Bottom,'onSuccess':function(){'alert("boo > > !");'},'evalScripts':true,'parameters':['_s=EagyxUvvWRPxlAdD', > > '_k=K3OXE7pw','4'].join('&')}) > > > > The problem is that to javascript code is printed with surrounding > > ticks ' and therefor cannot be executed. > > > > Am I doing something wrong or should be work that way? > > > > thanks, > > > > Norbert > > > > > > _______________________________________________ > > 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 NorbertHartl
If you put a String there, it is serialized as a String as well. Use
SUStresm on: 'alert("foo")' to include as verbatim. Cheers, Lukas On 7/22/08, Norbert Hartl <[hidden email]> wrote: > I need to chain some calls I do with Ajax. I found > the onComplete:, onSuccess: etc. handlers. Every example > I've found in the image uses them to invoke an html updater. > > Trying to do this > > ... > onClick: ( > html updater > callback: []; > onComplete: 'alert("booo!");' > ); > with: 'something'. > > leads to javascript code like > > new > Ajax.Updater('layers','http://localhost:9090/seaside/svgex',{'insertion':Insertion.Bottom,'onSuccess':function(){'alert("boo!");'},'evalScripts':true,'parameters':['_s=EagyxUvvWRPxlAdD','_k=K3OXE7pw','4'].join('&')}) > > The problem is that to javascript code is printed with surrounding > ticks ' and therefor cannot be executed. > > Am I doing something wrong or should be work that way? > > thanks, > > Norbert > > > _______________________________________________ > seaside mailing list > [hidden email] > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside > -- Lukas Renggli http://www.lukas-renggli.ch _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
"Lukas Renggli" <[hidden email]> wrote
> If you put a String there, it is serialized as a String as well. Use > > SUStresm on: 'alert("foo")' Just curious - would this be the more common usage? Would it make sense to have ST strings convert to JS expressions (unquoted)? Should be easy to add the quotes if that is what is desired. Sophie _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
> > If you put a String there, it is serialized as a String as well. Use
> > > > SUStresm on: 'alert("foo")' > > Just curious - would this be the more common usage? Would it make sense to > have ST strings convert to JS expressions (unquoted)? Should be easy to add > the quotes if that is what is desired. For me it is the only logical usage. The following Smalltalk objects map to their JavaScript (PrototypeJS) counterparts: Association, Character, Collection, Color, Date, Dictionary, Duration, Interval, Point, String, and UndefinedObject. To complicate things, JavaScript string literals needs a completely different encoding than JavaScript code. Now I agree that the introduction of verbatim JavaScript is a bit complicated right now. This could be simplified by adding a converter message to String. I haven't found the perfect name of this message yet, but something along String>>asVerbatimJavascript ^ SUStream on: self I also agree that putting a String into an event handler does not make sense in any case. This could be resolved by adding something along (all event handler automatically call #asFunction on the event handler): String>>asFunction ^ (SUStream on: self) asFunction However this would mean that depending on the context where an object is used it gets converted to something else. I don't know if this is good or bad? Up to now I decided against doing it, but since discussion came up it is maybe time to change? What do you think? Lukas -- Lukas Renggli http://www.lukas-renggli.ch _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
I made an experimental commit to the Seaside 2.9 branch:
Name: Scriptaculous-Core-lr.33 Author: lr Time: 22 July 2008, 9:54:35 pm UUID: f85933bb-5d2b-4c52-a33a-5b47e336dc18 Ancestors: Scriptaculous-Core-lr.32 - treat strings passed in to event handlers automatically as verbatim JavaScript code (experimental) On 7/22/08, Lukas Renggli <[hidden email]> wrote: > > > If you put a String there, it is serialized as a String as well. Use > > > > > > SUStresm on: 'alert("foo")' > > > > Just curious - would this be the more common usage? Would it make sense to > > have ST strings convert to JS expressions (unquoted)? Should be easy to add > > the quotes if that is what is desired. > > > For me it is the only logical usage. The following Smalltalk objects > map to their JavaScript (PrototypeJS) counterparts: Association, > Character, Collection, Color, Date, Dictionary, Duration, Interval, > Point, String, and UndefinedObject. To complicate things, JavaScript > string literals needs a completely different encoding than JavaScript > code. > > Now I agree that the introduction of verbatim JavaScript is a bit > complicated right now. This could be simplified by adding a converter > message to String. I haven't found the perfect name of this message > yet, but something along > > String>>asVerbatimJavascript > ^ SUStream on: self > > I also agree that putting a String into an event handler does not make > sense in any case. This could be resolved by adding something along > (all event handler automatically call #asFunction on the event > handler): > > String>>asFunction > ^ (SUStream on: self) asFunction > > However this would mean that depending on the context where an object > is used it gets converted to something else. I don't know if this is > good or bad? Up to now I decided against doing it, but since > discussion came up it is maybe time to change? What do you think? > > > Lukas > > > -- > Lukas Renggli > http://www.lukas-renggli.ch > -- Lukas Renggli http://www.lukas-renggli.ch _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
In reply to this post by Lukas Renggli
"Lukas Renggli" <[hidden email]> wrote
> I haven't found the perfect name of this message > yet, but something along > > #1 > String>>asVerbatimJavascript > ^ SUStream on: self > > ... > #2 > String>>asFunction > ^ (SUStream on: self) asFunction +1 for either. I am not comfortable with the style of exposing/using concrete classes like SUStream, prefer either methods (#1) or convention (#2) over it. Sophie _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Free forum by Nabble | Edit this page |