I currently have a servlet that takes the XML submitted from my XForm and uses it to generate
a PDF file. I would like to have a button that performs this action, but am having trouble understanding how to implement it. My submission currently looks like this: <xforms:submission id="save-submission" mode="asynchronous" action="/form/pdf" xxforms:target="_blank" method="post" f:url-norewrite="true" replace="instance" ref="instance('fr-form-instance')"> <xxforms:script ev:event="xforms-submit">checkSubmissionStatus();</xxforms:script> </xforms:submission> This works well, but my PDF is not coming out. If I hit the http://localhost/app/form/pdf, the PDF is served properly. What am I missing? Thanks in advance. |
I see several possible problems:
1. Because you have f:url-norewrite="true", the XML is submitted to http://localhost/form/pdf, not http://localhost/app/form/pdf. If servlet is in the same webapp as Orbeon, you could just remove this attribute. Or maybe f:url-norewrite="true" is correct, but you just forgot to add /app in URL. 2. If you want to download that PDF after submit, you should use replace="all" instead of replace="instance". 3. I'm not sure if mode="asynchronous" and xxforms:target="_blank" add any value. I would just remove them to be safe. Instead I would add xxforms:show-progress="false", so that "Loading..." message will not be left hanging. Tambet On 19.12.2011 21:39, Kaex wrote: > I currently have a servlet that takes the XML submitted from my XForm and > uses it to generate > a PDF file. I would like to have a button that performs this action, but am > having trouble understanding how to implement it. My submission currently > looks like this: > > <xforms:submission id="save-submission" mode="asynchronous" > action="/form/pdf" xxforms:target="_blank" > method="post" f:url-norewrite="true" > replace="instance" ref="instance('fr-form-instance')"> > > <xxforms:script > ev:event="xforms-submit">checkSubmissionStatus();</xxforms:script> > </xforms:submission> > > This works well, but my PDF is not coming out. If I hit the > http://localhost/app/form/pdf, the PDF is served properly. What am I > missing? > > Thanks in advance. > > -- > View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/Custom-PDF-Button-tp4215368p4215368.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 |
Tambet,
Thanks for leading me in the right direction. I had to do two things: 1) Change to replace="all". 2) Make the action URL absolute, i.e. http://localhost/form/pdf After making those changes, it worked. :) Is there a way where I can use a relative URL and avoid a local submission? If I change the action back to "/form/pdf", it doesn't work because it's attempting a local submission. I'm running a separate deployment with Orbeon separate from my WAR. |
I was able to get it working. It turns out I wasn't setting the 'oxf.xforms.local-submission-forward' property to false.
Thanks again! |
Glad you figured it out! It might be worth brief investigation, why
local submission doesn't work. Do you have filters that won't be applied with local submission? This can be easily cured with few additional web.xml elements, see here: http://nirlevy.blogspot.com/2007/09/requestdispatcherforward-and-filters.html Local submission performs better and you won't get errors when running the server behind https proxy with untrusted SSL certificate. Tambet On 20.12.2011 18:20, Kaex wrote: > I was able to get it working. It turns out I wasn't setting the > 'oxf.xforms.local-submission-forward' property to false. > > Thanks again! > > -- > View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/Custom-PDF-Button-tp4215368p4218388.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 |
Free forum by Nabble | Edit this page |