Have you considered adding a hidden AJAX-enabled Form to the page containing (1) a content TextField and (2) a Submit? On click of Test Button, make your JavaScript set the value of (1) to whatever is in the editor and do click() on (2).
Server-side, you’d provide all the usual event-handling for a form (eg. onValidateFromMyHiddenForm(), onSuccessFromMyHiddenForm(), etc.). This way, I suspect it would become very easy to implement, read, and maintain. In case it helps, here’s an example of an AJAX Form that isn’t hidden: http://jumpstart.doublenegative.com.au/jumpstart/examples/ajax/formmultiplezoneupdate Geoff > On 27 May 2015, at 8:11 pm, Poggenpohl, Daniel > <daniel.poggenp...@isst.fraunhofer.de> wrote: > > Hello again, > > exactly, I'm using Tapestry 5.3.8 and tapestry-jquery. Is there any js > function here that I can use to automatically process zone ajax updates? > > Regards, > Daniel P. > > -----Ursprüngliche Nachricht----- > Von: Nathan Quirynen [mailto:nat...@pensionarchitects.be] > Gesendet: Mittwoch, 27. Mai 2015 11:38 > An: users@tapestry.apache.org > Betreff: Re: AW: AW: Adding JS to my component combined with using t:If > > I think he is not using 5.4 but 5.3.8. > > The problem is that your ajax call does not process the repsonse (zones to > update, scripts to run, ...). > > What I have done is adding the following to the success callback function: > > function(r) { > // update zones and call added javascript > if (r.zones) { > // perform multi zone update > $.each(r.zones, function(zoneId) { > $('#' + > zoneId).tapestryZone("applyContentUpdate", r.zones[zoneId]); > }); > } > > if (r.updateZone) { > var spec = { > url : r.updateZone.url, > params : r.updateZone.params > }; > $('#' + > r.updateZone.zoneId).tapestryZone("update", spec); > } > $.tapestry.utils.loadScriptsInReply(r); > } > > > This works for me, but I'm also very interested in a better way than > what I have done above as this seems like a hassle to add it everywhere... > > Greetings, > Nathan > > > On 27/05/15 11:29, Chris Poulsen wrote: >> It is the tapestry module I'm referring to. >> >> It is located in the sources as coffeescript: >> tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/ajax.coffee >> >> or in the tapestry-core.jar ( META-INF/modules/t5/core/ajax.js ) >> >> The generated documentation for the module is here: >> http://tapestry.apache.org/5.4/coffeescript/ajax.html >> >> The sources are the best place to go if you want to know how the stuff is >> put together beneath the covers. >> >> On Wed, May 27, 2015 at 11:25 AM, Poggenpohl, Daniel < >> daniel.poggenp...@isst.fraunhofer.de> wrote: >> >>> Hello, >>> >>> I am a certified newcomer to all of this. >>> Searching on google for ajax.js gives me multiple results which all look >>> like different libraries. Does Tapestry provide an ajax.js library? Does >>> JQuery provide an ajax.js library? What other ajax.js library should I use >>> to generate my POST? Is the POST request I generated buggy? How would using >>> the other library help me? >>> >>> Regards, >>> Daniel P. >>> >>> -----Ursprüngliche Nachricht----- >>> Von: Chris Poulsen [mailto:mailingl...@nesluop.dk] >>> Gesendet: Mittwoch, 27. Mai 2015 11:19 >>> An: Tapestry users >>> Betreff: Re: AW: AW: Adding JS to my component combined with using t:If >>> >>> take a look at the ajax.js module and see if you can use that instead of >>> generating your own $.post >>> >>> On Wed, May 27, 2015 at 10:45 AM, Poggenpohl, Daniel < >>> daniel.poggenp...@isst.fraunhofer.de> wrote: >>> >>>> Hello again, >>>> >>>> I have generated the event urls and given them to my editor >>>> initialization script. >>>> An excerpt: >>>> setup : function(editor) { >>>> editor.addButton('testButton', { >>>> text: 'Test Button', >>>> icon: false, >>>> onclick: function() { >>>> var sentData = {paragraphContent : >>>> tinymce.activeEditor.getContent()}; >>>> $.post( >>>> jsonObject.saveUrl, >>>> sentData, >>>> function(data, status) { >>>> >>> tinymce.remove(jsonObject.elemId); >>>> } >>>> ); >>>> } >>>> }); >>>> } >>>> >>>> When the user clicks the test button, an AJAX request containing the >>>> content of the editor is sent to the server. After receiving the >>>> response the editor should be removed from the DOM. >>>> >>>> The handler side: >>>> void onSaveWork(@RequestParameter(value="paragraphContent") final >>>> String >>>> paragraphContent) { >>>> showEditor = false; >>>> ajaxResponseRenderer.addRender(chapterContentZone); >>>> } >>>> >>>> To be simple at first, the event handler only sets showEditor and >>>> queues a render of the zone containing the editor. So the only thing >>>> that should be happening is that the div displaying the read-only >>>> content should reappear, which it doesn't. >>>> >>>> I guess this is because the response isn't handled automatically and I >>>> have to replace a client-side DOM element with the "data" content of >>>> the response. Is it because I use a self-written javascript and don't >>>> rely fully on Tapestry here? Should I use some functions of tapestry.js? >>>> >>>> Am I doing something wrong here or am I on the right track? >>>> >>>> Regards, >>>> Daniel P. >>>> >>>> -----Ursprüngliche Nachricht----- >>>> Von: Poggenpohl, Daniel >>>> Gesendet: Mittwoch, 27. Mai 2015 09:02 >>>> An: Tapestry users >>>> Betreff: AW: AW: AW: Adding JS to my component combined with using >>>> t:If >>>> >>>> Hi, >>>> >>>> thank you for helping me. Again I had wording issues, it seems. >>>> I did know that event handling methods on Tapestry pages and >>>> components are written manually. >>>> I just wrote "event handlers" because I thought there was something in >>>> between the handler methods and the Eventlinks that was generated when >>>> an Eventlink is created. Now I have realized that creating an >>>> Eventlink amounts to generating the markup for a link with the URL >>>> containing the event name. When you then send a request with this URL, >>>> Tapestry sees the event and looks for an appropriately named handler in >>> the page/component. >>>> I had just thought there was more to it. >>>> >>>> As you say in your advice, I expected too much and am now using the >>>> method of generating an Eventlink request URL that I give to the >>>> tinyMCE editor so that the appropriate request is made at the expected >>>> time. I think that is the way to go. >>>> >>>> I also thought that JavaScript events, HTML DOM events and Tapestry >>>> Component Events were the same before. >>>> >>>> Regards, >>>> Daniel P. >>>> >>>> -----Ursprüngliche Nachricht----- >>>> Von: Thiago H de Paula Figueiredo [mailto:thiag...@gmail.com] >>>> Gesendet: Dienstag, 26. Mai 2015 20:58 >>>> An: Tapestry users >>>> Betreff: Re: AW: AW: Adding JS to my component combined with using >>>> t:If >>>> >>>> On Tue, 26 May 2015 11:49:20 -0300, Poggenpohl, Daniel < >>>> daniel.poggenp...@isst.fraunhofer.de> wrote: >>>> >>>>> Hi again, >>>> Hi! >>>> >>>>> Jquery can define arbitrary events that can be triggered. I thought >>>>> I could raise a JS event and handle it via "onEVENTNAME" on the >>>>> Tapestry component side. But of course that doesn't work, probably >>>>> because no event handlers are generated because no corresponding >>>>> eventlink is created. >>>> Event handlers aren't generated at all by Tapestry. You declare them >>>> by using @OnEvent or using a naming convention. You just cannot >>>> trigger a JS event and expect it to magically trigger a server-side >>> event. >>>> Tapestry doesn't need an EventLink or ActionLink to be able to trigger >>>> an event handler method in the server-side. You can create your own >>>> events and their URLs by using ComponentResources.createEventLink(). >>>> With the URL generated by that method, you can invoke them using AJAX in >>> JS. >>>> -- >>>> Thiago H. de Paula Figueiredo >>>> Tapestry, Java and Hibernate consultant and developer >>>> http://machina.com.br >>>> >>>> --------------------------------------------------------------------- >>>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >>>> For additional commands, e-mail: users-h...@tapestry.apache.org >>>> >>>> > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org