triggering a submission with javascript

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

triggering a submission with javascript

David McIntyre
I'm trying to get a javascript function to be able to trigger a submission to occur.  From my reading of the documentation at http://www.orbeon.com/ops/doc/reference-xforms-ng#xforms-javascript-events my understanding is that I ought to be able to use ORBEON.xforms.Document.dispatchEvent('<the id of the submission>','xforms-submit') but that doesn't seem to work for me.  I can add a trigger which sends the submission, and then use javascript to send a DOMActivate event to the trigger, but I can't send an xforms-submit directly to the submission. 

One thing I considered was that perhaps xforms-submit counts as an "external event" as mentioned in the warning in the documentation.  However, I wasn't able to fix things by adding the attribute xxforms:external-events="xforms-submit" to the model.

I've attached a simple version in which the first javascript link does not fire a submission whereas the second link does send a DOMActivate to the button which in turn fires a submission.

--
Orion Signature
Dave McIntyre
Software Developer
2nd Floor, Orion House, cnr Enfield & Mary St, Mt Eden, PO Box 8273, Auckland, New Zealand
M.+64 21 212 8087 P.+64 9 638 0600 F.+64 9 638 0699
S.<a href="callto:dave.mcintyre">dave.mcintyre E.[hidden email] W.www.orionhealth.com




This e-mail and any attachments are intended only for the person to whom it is addressed and may contain privileged, proprietary, or other data protected from disclosure under applicable law. If you are not the addressee or the person responsible for delivering this to the addressee you are hereby notified that reading, copying or distributing this transmission is prohibited. If you have received this e-mail in error, please telephone us immediately and remove all copies of it from your system. Thank you for your co-operation.


--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws

javascript-submit.xhtml (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: triggering a submission with javascript

Erik Bruchez
Administrator
Dave,

 > I'm trying to get a javascript function to be able to trigger a
 > submission to occur.  From my reading of the documentation at
 >
http://www.orbeon.com/ops/doc/reference-xforms-ng#xforms-javascript-events
 > my understanding is that I ought to be able to use
 > ORBEON.xforms.Document.dispatchEvent('<the id of the
 > submission>','xforms-submit') but that doesn't seem to work for me.  I
 > can add a trigger which sends the submission, and then use javascript to
 > send a DOMActivate event to the trigger, but I can't send an
 > xforms-submit directly to the submission.
 >
 > One thing I considered was that perhaps xforms-submit counts as an
 > "external event" as mentioned in the warning in the documentation.
 > However, I wasn't able to fix things by adding the attribute
 > xxforms:external-events="xforms-submit" to the model.
 >
 > I've attached a simple version in which the first javascript link does
 > not fire a submission whereas the second link does send a DOMActivate to
 > the button which in turn fires a submission.

For security reasons, you can't dispatch built-in events (i.e. DOM
events or XForms events, except DOMActivate, DOMFocusIn and
DOMFocusOut) from JavaScript, even if you use
xxforms:external-events. I realized that this was not explicit in the
doc so I updated it.

If you use a custom event instead, then things work. See attached.

-Erik

--
Orbeon - XForms Everywhere:
http://www.orbeon.com/blog/



--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws

javascript-submit.xhtml (2K) Download Attachment