Re: xxforms:download on a single click
Posted by
Erik Bruchez on
URL: https://discuss.orbeon.com/xxforms-download-on-a-single-click-tp3297720p3300705.html
The way the download appearance works is through an indirection:
* the XForms engine generates a link URL for use in the browser
* when the user clicks the link, the XForms engine looks up in the session a mapping between that URL and the content
In order for the download to start automatically, the browser must be told to load that URL. This might be doable with some JavaScript.
You would still use the xforms;output, but hide it with CSS.
Then, upon submission completion, run some JavaScript:
<xxforms:script ev:event="xforms-submit-done">
step 1: find value of URL in xforms:output control
step 2: set window.location = that URL
I haven't tried this but it might work.
-Erik
On Wed, Feb 9, 2011 at 9:20 AM, ssethia
<[hidden email]> wrote:
Hi All,
I have a set of documents which are shown to the user from a UI, the user is
provided with a download link (xforms:trigger) to download a particular
document from the set of documents. On click of a particular download link I
would like to go to the database, grab the document and show the download
dialog. How can this be achieved?
The current code looks like this
<!-- trigger -->
<xforms:trigger appearance="minimal" id="upload-download-trigger">
<xforms:label>Download</xforms:label>
<xforms:action ev:event="DOMActivate">
<xforms:setvalue ref="instance('selected-document')"
value="context()/document-name"/>
<xforms:send submission="get-document"/>
</xforms:action>
</xforms:trigger>
<!-- submission -->
<xforms:submission xxforms:username="xxxxx" xxforms:password="yyyyy"
id="get-document" serialization="none" method="get"
action="http://localhost:80/exist/rest/db/XXXXXX/info.xml"
replace="instance" instance="document-definition-instance">
<xxforms:show ev:event="xforms-submit-done" dialog="download-dialog"/>
</xforms:submission>
<!-- download dialog -->
<xxforms:dialog id="download-dialog" appearance="minimal"
neighbor="upload-download-trigger">
<xforms:output ref="instance('document-definition-instance')/attachment"
appearance="xxforms:download">
<xforms:label>Download instance</xforms:label>
<xforms:mediatype ref="@mediatype"/>
<xforms:filename ref="@filename"/>
</xforms:output>
</xxforms:dialog>
Since xxforms:download works with xforms:output, I'm forced to click twice,
first on the Download link created by the trigger to go and get the specific
document from the DB and then on the Download instance link created by the
xforms:output in the download-dialog.
Can the second action be omitted so that download the document just by a
single click.
Thanks
--ssethia
--
View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/xxforms-download-on-a-single-click-tp3297720p3297720.html
Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com.
--
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
--
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