This post was updated on .
Hi,
I'm reposting this because it has been pending to the mailing list for several days. I'm really hoping someone can help with a question I have: I've got a submission that fires javascript events for "xforms-submit", "xforms-submit-error", "xforms-submit-done" with some code in my view.xhtml that looks like this: <xf:submission xxforms:show-progress="false" id="rest-style" method="post" action="/path/to/eXist/instance" validate="false"> <xxforms:script ev:event="xforms-submit">pleaseWait();</xxforms:script> <xxforms:script ev:event="xforms-submit-error">errorReport();</xxforms:script> <xxforms:script ev:event="xforms-submit-done">weAreDone();</xxforms:script> </xf:submission> If I hit the submit button, everything works as expected; as soon as I click the button, the "xforms-submit" event appears to fire, which triggers my function called pleaseWait(); However, I don't want the entire page to be replaced, so I'm sending the results to an instance by adding this: replace="instance" instance="myInstance" Everything is working as it should (the instance is being replaced rather than the entire page) although once I've added the replace and instance attributes, it seems as if the order of the event firing goes off a bit. If I have the replace and instance attributes present and hit the submit button, I get the Loading... message in the top right-hand corner of the browser and then both the "xforms-submit" and the "xforms-submit-done" events seem to fire at precisely the same time - which isn't quite what I was hoping for! Is this the expected behaviour? If so, what would I need to do to trigger a javascript event as soon as the submit button is clicked if I have the replace and instance attributes present? I'm using Orbeon 3.6.0 Any help would be very gratefully received - thanks so much! |
Administrator
|
Alex,
On Sun, Apr 20, 2008 at 9:11 AM, Alex Bleasdale <[hidden email]> wrote: > Is this the expected behaviour? If so, what would I need to do to trigger a > javascript event as soon as the submit button is clicked if I have the > replace and instance attributes present? I'm using Orbeon 3.6.0 When a sequence of events is executed by the server, and in that sequence you have some <xxforms:script>, those will be all pushed to the end of the sequence. Another way to look at it is that the server runs all the events, and then tells the client "and here is some JavaScript for you to run". So if you want to run some JavaScript to run before the submission is done, instead of doing an <xforms:send>, you would have to run that JavaScript (<xxforms:script>) and at the end of the code in <xxforms:script> dispatch the xforms-submit event to the submission. Also make sure you have the relevant xxforms:external-events. You can find more about dispatching events from JavaScript at: http://www.orbeon.com/ops/doc/reference-xforms-2#xforms-javascript-events Alex -- Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise Orbeon's Blog: http://www.orbeon.com/blog/ Personal Blog: http://avernet.blogspot.com/ Twitter - http://twitter.com/avernet -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Free forum by Nabble | Edit this page |