Hi, I'm still trying to implement the AMChart component (or whatever),
and I managed to get down to the point when a URL is dynamically generated, requested, and my block is executed. Now, my problem is that this request does not generate any response, and rather generates a 302 Found with a Location... kind of redirect to the page containing the callback. The code I need should look like: someJSFunction('http://host/seaside/blah?_s=...&_k=...&...'); and I need the URL to return something dynamically generated from the block, in the example below it's the string 'some string I want returned'. My current try looks like: javascriptCodeOn: html | encoder | ^ String streamContents: [:strm | strm nextPutAll: 'someJSFunction('. encoder := WAURLEncoder on: strm. encoder nextPutAll: (html context actionUrl addParameter: (html callbacks registerCallback: [ 'some string I want returned'])) asString. strm nextPutAll: ');'. ] I also tried with registerActionCallback: and pretty much all the family. Also tried with self answer: 'some string...', and other combinations... Any help? what's wrong with this, and more important, how's is it right? and then... I think this could make it into a useful tutorial. I may be the first outside the core team to write a complex Component (I doubt it), but I'm surely not the last to do it. thanks! richie _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
> and then... I think this could make it into a useful tutorial. I may be
> the first outside the core team to write a complex Component (I doubt it), > but I'm surely not the last to do it. self session returnResponse: (WAResponse new nextPutAll: '...'; yourself). See the senders of #returnResponse: for more examples. Lukas -- Lukas Renggli http://www.lukas-renggli.ch _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Lukas Renggli wrote:
>> and then... I think this could make it into a useful tutorial. I may be >> the first outside the core team to write a complex Component (I doubt it), >> but I'm surely not the last to do it. >> > > self session returnResponse: (WAResponse new > nextPutAll: '...'; > yourself). > that absolutely made the trick!!! thanks a lot! Now I obviously need to make something useful, but that's now totally up to me :) richie _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
In reply to this post by Gerardo Richarte
I've been using the following trick suggested here in the list, to
register a dynamic callback, and it's been working perfectly. > encoder := WAURLEncoder on: strm. > encoder nextPutAll: (html context actionUrl > addParameter: (html callbacks registerCallback: [ > 'some string I want returned'])) asString. with this I get a URL looking something like: http://blah/blah?_s=...&_k=...&1 the &1 part is the trick. With that it get's back to me in the right place. Now I have a problem: I want to use two such callbacks in the same page, and it kind of works fine, and I get the URL: http://blah/blah?_s=...&_k=...&1&2 however, the &1 gets in the middle, and only the first callback is triggered. If I manually tweak the URL and GET ...&2 (without &1) the second callback is correctly triggered. So. I guess I can manage to hack a solution changing the parameters of the URL, but I wonder if there is a somehow standard way of doing it. thanks a lot for all the help, this list (and GemStone's) are amazingly helpful! richie _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
too long an email for too small a problem :)
Here I solved it, and I think quite cleanly. Let me know otherwise encoder := WAURLEncoder on: strm. encoder nextPutAll: (html context actionUrl copy addParameter: (html callbacks registerCallback: [ 'some string I want returned'])) asString. I'm just getting a copy of the URL before adding the parameters. richie _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
> encoder := WAURLEncoder on: strm.
> encoder nextPutAll: (html context actionUrl copy > addParameter: (html callbacks registerCallback: [ > 'some string I want returned'])) asString. > > I'm just getting a copy of the URL before adding the parameters. Yeah, you have to copy the original URL because it is used for all the callbacks on the page. There is the helper method #withParameter: that does the "copy addParameter:" thing all at once. Lukas -- Lukas Renggli http://www.lukas-renggli.ch _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Free forum by Nabble | Edit this page |