Open Pdf with same request Parameters

14 views
Skip to first unread message

jrabasilio

unread,
Nov 25, 2020, 2:58:12 PM11/25/20
to orb...@googlegroups.com

Hi,

I have a form with request parameters, url is
/fr/Teste/Teste002/edit/24922b9dd5e96440398421290a3ee241eed01082?value=222

When click in pdf button the value is not populate in my controller.

Properties.xml have this configuration :

<property as="xs:string" name="oxf.fr.detail.process.pdf.*.*">
navigate(
uri =
"/fr/{
xxf:instance('fr-parameters-instance')/app}/{
xxf:instance('fr-parameters-instance')/form}/pdf/{
xxf:instance('fr-parameters-instance')/document/string()}"
)
</property>

Have any tag for get value after document/string() ?
using xxf:get-request-parameter('value') is not solution , my forms have
many parameters, is not pratique.

Ths
João Basílio



--
Sent from: http://discuss.orbeon.com/

Alessandro Vernet

unread,
Nov 25, 2020, 8:25:52 PM11/25/20
to orb...@googlegroups.com
Hi João,

If you are passing a request parameter to your form, and would like to have
it available when the PDF is being produced, then you'll need to save that
value in the form data. That means creating a Hidden Field, and having its
initial value set to `xxf:get-request-parameter('value')`. But you're saying
that you would like not to use this function? Where does that constraint
comes from; or maybe I misunderstood your question?

-Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet

jrabasilio

unread,
Nov 27, 2020, 8:26:02 PM11/27/20
to orb...@googlegroups.com
Hi Alex,

I dont like use xxf:get-request-parameter('value') function in
properties-template.xml file, in controler is Ok.

In my case, request values is use in edit mode, new form is create by API
(application + "/" + form + "/data/" + uuid + "/data.xml
I send form to user is in edit mode, and in this moment pass request
values,in this case initial value not work, use calculate values.

I think, pdf mode use calculated values to fill this field, but in url not
have request values, and not show.


exemple :
/Teste002/edit/91486691a97ce5d692b9b4282662a0ec145536cf?teste=teste1

Field with name teste with calculated value
xxf:get-request-parameter('value') , filled with "teste1"

When click in "pdf" button to show pdf, redirect to
/Teste002/pdf/91486691a97ce5d692b9b4282662a0ec145536cf

Not have request value, pdf not show field teste filled.

using properties-template.xml if use
<property as="xs:string" name="oxf.fr.detail.process.pdf.*.*">
navigate(
uri =
"/fr/{
xxf:instance('fr-parameters-instance')/app}/{
xxf:instance('fr-parameters-instance')/form}/pdf/{

xxf:instance('fr-parameters-instance')/document/string()}?teste={xxf:get-request-parameter('teste')}"
)
</property>

This work fine, but i have many request values, and different name for
request-parameter.
And when add new request, have to remember to add it to the
properties-template, that way it becomes impractical.

one way is using Js
In properties-template.xml
<property as="xs:string" name="oxf.fr.detail.process.pdf.*.*">
navigate(uri = "javascript:pdfXis()" )
</property>

In js
function pdfXis(){
var currentURL = window.location.href;
currentURL = currentURL.replace("/edit/", "/pdf/");
window.open(currentURL, '_blank');
};

this way work.

Thanks

Alessandro Vernet

unread,
Nov 30, 2020, 12:34:08 PM11/30/20
to orb...@googlegroups.com
Hi João,

I'm glad using JavaScript to go from the `/edit` to the `/pdf` page passing
all the request parameters works for you, and thank you for the sharing this
technique.

-Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply all
Reply to author
Forward
0 new messages