Result-dialog display PDF url link

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

Result-dialog display PDF url link

vbr
Hi,

I would like to display the pdf url link in the result-dialog so that user
can download the pdf when the form is submitted. Do you know how can I
archieve this?

Thank you for your help.

--
Sent from: http://discuss.orbeon.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].
Reply | Threaded
Open this post in threaded view
|

Re: Result-dialog display PDF url link

Alessandro  Vernet
Administrator
Hi Vincent,

Do you already have your own confirmation page? If so, in your "send"
process, you can use the `send(content = "pdf-url")` action to have Orbeon
Forms send to your confirmation page an XML document that contains an URL
pointing back to Orbeon Forms, that you can use in an ` PDF <…>  ` on your
confirmation page. You can find more about this on:

https://doc.orbeon.com/form-runner/advanced/buttons-and-processes/actions-form-runner/actions-form-runner-send#sending-a-pdf-url

You'll let me know if this works for you.

‑Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
Sent from: http://discuss.orbeon.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].
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
vbr
Reply | Threaded
Open this post in threaded view
|

Re: Result-dialog display PDF url link

vbr
Hi Alessandro,

Thank you for your answer.

No I haven't my own confirmation page. How can I make this?
Actually I use the result dialog.

Vincent

--
Sent from: http://discuss.orbeon.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].
Reply | Threaded
Open this post in threaded view
|

Re: Result-dialog display PDF url link

Alessandro  Vernet
Administrator
In reply to this post by vbr
Hi Vincent,

I imagine you're referring to the "result dialog" (see link below)? If so,
then no, this dialog doesn't support a "Download PDF" button. So this is
something you'll need to do on your own confirmation page.

https://doc.orbeon.com/form-runner/advanced/buttons-and-processes/predefined#the-result-dialog

‑Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
Sent from: http://discuss.orbeon.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].
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Result-dialog display PDF url link

Alessandro  Vernet
Administrator
Hi Vincent, following-up on this, does creating your own separate
confirmation page work for you? Is this maybe something you've already tried
to do?

‑Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
Sent from: http://discuss.orbeon.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].
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
vbr
Reply | Threaded
Open this post in threaded view
|

Re: Result-dialog display PDF url link

vbr
Hi Alex,

I tried by "patching" the file "submission-dialog.xhtml like this :

...
 
                <xf:trigger ref="instance()[context() = 'pdf']">
                    <xf:label mediatype="text/html"
value="$fr-resources/buttons/submit-dialog-pdf"/>
                    <xf:action ev:event="DOMActivate">
                        <xf:var name="uri-xpath" value="concat('/fr/',
fr:app-name(), '/', fr:form-name(), '/pdf/', fr:document-id(),
'?fr-language=fr')"/>
                        <xf:load context="xxf:instance('fr-form-instance')"
resource="{$uri-xpath}"/>
                    </xf:action>
                </xf:trigger>
...

It almost works but I got the following error when I use the proxy-portlet :

/19:39:51,132 ERROR [http-bio-7080-exec-17][render_portlet_jsp:132] null
java.lang.IllegalArgumentException: application/pdf is an unsupported
content type
        at
com.liferay.portlet.MimeResponseImpl.setContentType(MimeResponseImpl.java:159)
        at
org.orbeon.private.orbeon.oxf.portlet.BufferedPortlet$$anonfun$org$orbeon$oxf$portlet$BufferedPortlet$$writeResponseWithParameters$3.apply(BufferedPortlet.scala:1172)
        at org.orbeon.private.scala.Option.foreach(Option.scala:257)
        at
org.orbeon.private.enumeratum.EnumEntry.org$orbeon$oxf$portlet$BufferedPortlet$$writeResponseWithParameters(EnumEntry.scala:23172)
        at
org.orbeon.private.orbeon.oxf.portlet.BufferedPortlet$$anonfun$bufferedRender$1.apply(BufferedPortlet.scala:1110)
        at
org.orbeon.private.orbeon.oxf.util.IOUtils$.useAndClose(IOUtils.scala:60)
        at
org.orbeon.oxf.portlet.OrbeonProxyPortlet$$anonfun$doView$1$$anonfun$apply$1.apply$mcV$sp(OrbeonProxyPortlet.scala:1110)
        at
org.orbeon.oxf.portlet.OrbeonProxyPortlet$$anonfun$doView$1$$anonfun$apply$1.apply(OrbeonProxyPortlet.scala:1137)
        at
org.orbeon.oxf.portlet.OrbeonProxyPortlet$.withRootException(OrbeonProxyPortlet.scala:423)
        at
org.orbeon.oxf.portlet.OrbeonProxyPortlet$$anonfun$doView$1.apply(OrbeonProxyPortlet.scala:1137)
        at org.orbeon.private.scala.Option.foreach(Option.scala:257)
        at
org.orbeon.oxf.portlet.OrbeonProxyPortlet.doView(OrbeonProxyPortlet.scala:136)
        at javax.portlet.GenericPortlet.doDispatch(GenericPortlet.java:359)
        at javax.portlet.GenericPortlet.render(GenericPortlet.java:262)
        at
com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:103)
        at
com.liferay.portlet.ScriptDataPortletFilter.doFilter(ScriptDataPortletFilter.java:55)
        at
com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:100)
        at
org.orbeon.oxf.portlet.liferay.AddLiferayUserHeadersFilter.doFilter(FormRunnerAuthFilter.scala:60)
        at
com.liferay.portal.kernel.bean.ClassLoaderBeanHandler.invoke(ClassLoaderBeanHandler.java:67)
        at
com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:100)/

Do you have any idea?

Thank you for your help!

--
Sent from: http://discuss.orbeon.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].
Reply | Threaded
Open this post in threaded view
|

Re: Result-dialog display PDF url link

Alessandro  Vernet
Administrator
Hi Vincent,

I imagine that with Liferay you can't just issue an `xf:load` that serves a
binary file to be sent to the browser. Are you able to get the plain PDF
button that shows at the bottom of the form to work in Liferay? If so, try
adding the following, after the `</xf:repeat>` (I checked that this works
outside of Liferay):

<fr:process-button ref="instance()" name="pdf"/>

‑Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
Sent from: http://discuss.orbeon.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].
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
vbr
Reply | Threaded
Open this post in threaded view
|

Re: Result-dialog display PDF url link

vbr
Hi Alex,

Yes It works! But now, I have to make it configurable depending on
application and form name.

Thank you

--
Sent from: http://discuss.orbeon.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].
vbr
Reply | Threaded
Open this post in threaded view
|

Re: Result-dialog display PDF url link

vbr
I answer to myself.

I finally managed by making this :

 
<xf:trigger ref="instance()[context() = 'pdf']">
   <xf:label mediatype="text/html"
value="$fr-resources/buttons/submit-dialog-pdf"/>
   <xf:action  ev:event="DOMActivate" type="xpath">
     
xxf:instance('fr-form-instance')/fr:run-process-by-name('oxf.fr.detail.process',
'pdf')
   </xf:action>
</xf:trigger>

Thank you for your help!

--
Sent from: http://discuss.orbeon.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].
vbr
Reply | Threaded
Open this post in threaded view
|

Re: Result-dialog display PDF url link

vbr
I would like to call the action in javascript. Do you known how I can do
this?

I tried by dispatching an event like this, but it doesn't work :

<xf:model id="fr-submission-result-model"
xxf:external-events="download-pdf">

       
       
        <xf:setvalue
                event="xxforms-dialog-close"
                observer="fr-submission-result-dialog"
                ref="instance()"/>

        <xf:instance id="fr-submission-result-instance">
            <content xmlns=""/>
        </xf:instance>

        <xf:action ev:event="download-pdf" type="xpath">
           
xxf:instance('fr-form-instance')/fr:run-process-by-name('oxf.fr.detail.process',
'pdf')
        </xf:action>
    </xf:model>

ORBEON.xforms.Document.dispatchEvent({targetId:
'fr-submission-result-model', eventName: 'download-pdf'})

I got this error in log :

2019-04-02 03:30:00,092 DEBUG XFormsServer  -   ignoring invalid client
event on target {id: "fr-submission-result-model", event name:
"download-pdf"}


--
Sent from: http://discuss.orbeon.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].
Reply | Threaded
Open this post in threaded view
|

Re: Result-dialog display PDF url link

Alessandro  Vernet
Administrator
Hi Vincent,

I'm glad that running the `pdf` process with `fr:run-process-by-name()`
worked for you. Your code dispatching the event from JavaScript looks
correct to me. But I'm wondering if you might have this problem because
you're dispatching the event to a model that is inside a dialog (so it might
not be available under that name at the top level). Could you try moving the
event handler and the `xxf:external-events="download-pdf"` attribute to
another model, maybe a custom model (see link below)?

https://doc.orbeon.com/form-runner/advanced/custom

‑Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
Sent from: http://discuss.orbeon.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].
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
vbr
Reply | Threaded
Open this post in threaded view
|

Re: Result-dialog display PDF url link

vbr
Hi Alex,

I moved the xxf:external-events="download-pdf" to the root result-dialog and
now it works.

Thank you for your help.

--
Sent from: http://discuss.orbeon.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].
Reply | Threaded
Open this post in threaded view
|

Re: Result-dialog display PDF url link

Alessandro  Vernet
Administrator
Excellent Vincent, I'm glad you got this to work.

‑Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
Sent from: http://discuss.orbeon.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].
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet