Hi,
I have deployed Orbeon Forms as separate deployement. In my webpage I have an iframe to which OF is loaded. The XForms files loaded are created by other users so I can't affect what this form contains. The problem is I want submit this form from my webpage, from outside the iframe. My idea is to add an submission to the loaded model before it is send to orbeon: ... <xf:submission id="save-submission" ref="instance('doc-instance')" resource="url" method="put" replace="none" /> </xf:model> Then I can submit using javascript like this: <input type="button" onclick="ORBEON.xforms.Document.dispatchEvent('save-submission-button', 'DOMActivate')" value="My save"></input> <xf:submit submission="save-submission" id="save-submission-button"> <xf:label>Save</xf:label> </xf:submit> The problem is that I must now id of xf:submit control generate by orbeon inside form view. I've been trying submit using only id form a model: "save-submission" but it not works. Is there a way to submit form using javascript without adding button to view? Or is there an other way to submit form form an containing frame document? Any help needed... |
Would it be an option to use CSS to display prevent the submit button
from rendering? Then it would still be accessible to JavaScript. Though I have not personally tried to do this, I believe some have had good results using JQuery to embed Orbeon forms into an webpage without the need for an iFrame. This may be a solution for you depending on whether or not you have another requirement for an iFrame. -Stian -----Original Message----- From: chodnik [mailto:[hidden email]] Sent: 10 July 2013 13:14 To: [hidden email] Subject: [orbeon] How to submit form from outside an iframe? Hi, I have deployed Orbeon Forms as separate deployement. In my webpage I have an iframe to which OF is loaded. The XForms files loaded are created by other users so I can't affect what this form contains. The problem is I want submit this form from my webpage, from outside the iframe. My idea is to add an submission to the loaded model before it is send to orbeon: ... <xf:submission id="save-submission" ref="instance('doc-instance')" resource="url" method="put" replace="none" /> </xf:model> Then I can submit using javascript like this: <input type="button" onclick="ORBEON.xforms.Document.dispatchEvent('save-submission-button', 'DOMActivate')" value="My save"></input> <xf:submit submission="save-submission" id="save-submission-button"> <xf:label>Save</xf:label> </xf:submit> The problem is that I must now id of xf:submit control generate by orbeon inside form view. I've been trying submit using only id form a model: "save-submission" but it not works. Is there a way to submit form using javascript without adding button to view? Or is there an other way to submit form form an containing frame document? Any help needed... -- View this message in context: http://discuss.orbeon.com/How-to-submit-form-from-outside-an-iframe-tp46 56998.html Sent from the Orbeon Forms community mailing list mailing list archive at Nabble.com. -- You received this message because you are subscribed to the Google Groups "Orbeon Forms" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. -- You received this message because you are subscribed to the Google Groups "Orbeon Forms" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. |
Thanks for the advice. I'll try this solution. But I hope there is a better way less tricky. Maybe I can add an parameter to xf:submission to define an id which I can refer from Javascript.
Using Orbeon without iframe doesn't change anything. There were a portlet support but I found in version 4.2 it is not supported because of too many problems using it. Anyway, for me it is the same problem with submission without a button inside a form. |
In reply to this post by chodnik
I think the Orbeon JavaScript API only allows you to interact with the
view components of the form in terms of setting new values. You can however dispatch XForms events to the model. Thanks for the heads up about 4.2 and portlet support. We are about to roll out "orbeon-4.1.0.201304182144-PE" using Form Runner via the proxy portlet to our non-production environment where we will put it through tests. This basic portlet deployment option with the specified version appears to function quite well based on the limited testing we have done to date. We are hoping to upgrade to a 4.2 release very soon and we will definitely re-test the portlet support. -Stian -----Original Message----- From: chodnik [mailto:[hidden email]] Sent: 12 July 2013 07:26 To: [hidden email] Subject: [orbeon] RE: How to submit form from outside an iframe? Thanks for the advice. I'll try this solution. But I hope there is a better way less tricky. Maybe I can add an parameter to xf:submission to define an id which I can refer from Javascript. Using Orbeon without iframe doesn't change anything. There were a portlet support but I found in version 4.2 it is not supported because of too many problems using it. Anyway, for me it is the same problem with submission without a button inside a form. -- View this message in context: http://discuss.orbeon.com/How-to-submit-form-from-outside-an-iframe-tp46 56998p4657002.html Sent from the Orbeon Forms community mailing list mailing list archive at Nabble.com. -- You received this message because you are subscribed to the Google Groups "Orbeon Forms" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. -- You received this message because you are subscribed to the Google Groups "Orbeon Forms" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. |
Thank you Stian. It was very helpful, that events can be dispatched by the model just the same as it is a xf:submit or xf:trigger. Then I can use id of xf:submission from inside this model and so use javascript to fire events.
About protlets support: in this link http://wiki.orbeon.com/forms/doc/developer-guide/xforms-separate-deployment-with-portlets there is an info NOTE: This feature is no longer available with Orbeon Forms 4. See this issue for more details. Maybe I misinterpreted this info and it is not relating to Orbeon 4.1 and 4.2. However I decided use an internal frame to separate my application and the orbeon forms. |
Administrator
|
Separate deployment with portlet doesn't work at this point, but this feature is rarely used, and you can deploy Orbeon Forms as a "regular" portlet in Liferay. In particular, for forms you create with Form Builder, see:
http://wiki.orbeon.com/forms/doc/developer-guide/form-runner/form-runner-proxy-portlet-guide BTW, I like Stian's idea of hiding the submit button within the iframe with CSS, and simulating a click on that button from your JavaScript triggered by an action outside of the iframe. While this may sounds "hacky", you're just doing programmatically what users do, which is pretty easy to understand, and this way your code doesn't need to rely on lower level "APIs", which are maybe more likely to change. Alex
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Free forum by Nabble | Edit this page |