Hi JV, I don't think I can do that because the WYSIWYG and the submit buttons on the page are separated. For me the WYSIWYG is like an HTML text area. It can be added to a form which contains other fields and possible other WYSIWYG instances. So I think it's good to have the submit buttons separated from the WYSIWYG. That being the case, the WYSIWYG cannot listen to the submit buttons and, instead of directly submitting the form, make an asynchronous call to the server for the conversion and only upon receiving the response submit the form, simply because the WYSIWYG is not aware of the submit buttons present the page. The only hook is the onsubmit event of the form, provided the WYSIWYG is inside a form, which is not always the case. So I guess I could listen to the submit event, stop it, request the conversion and trigger the real submit after I get the response (following the pattern suggested by you). But as I said, this looks to me like an error-prone code for two reasons: * the form could already have onsubmit logic/listeners * GWT doesn't provide an API for wrapping an exiting HTML form but only for creating a new one. I'd have to write this code. So you think this is better than using a filter on the server side? Thanks, Marius
On Tue, Jul 29, 2008 at 4:03 PM, Marius Dumitru Florea <[email protected]> wrote:
Asynchronously retrieving the result of the conversion before submitting the edit form is tricky due to the fact that the user can click "Save & View" before the response arrives.
In light of this, Sergiu suggested me the following 2 solutions:
A) Retrieve the conversion synchronously This would be easy if GWT would allow it. Instead I'd have to write error-prone code using timeout to wait for the response and then release the form submit.
Can't you just write an AJAX call to the renderer which include a nested callback to the save action ? I'm thinking here about how we could do it with prototype, something like : new Ajax.Request('getWikiContentURL', { onSuccess:function(){ new Ajax.Request('savePage', {} ) } } [...] )
JV. _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs