Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

queXMLPDF export on Completed view

More
8 years 1 month ago #172507 by QuoTil
Hi folx,

using Version 3.8.2+180529 - fruity theme

I'd like the implement the "queXMLPDF export" button on the "Completed" screen (view). I've found the corresponding piece of code in "printanswers_head.twig":
Code:
{{ C.Html.form(aSurveyInfo.printAnswersHeadFormQueXMLUrl, 'post') }} {{ gT("Export these responses to QXML:") }} <button class="btn btn-default" type="submit"> {{ gT("queXMLPDF export") }} </button> {{ C.Html.endForm }}

I pasted this snippet in "submit.twig" on screen "Completed" but it doesn't work. When looking at the html the action of C.Html.form is missing what makes me think that
Code:
aSurveyInfo.printAnswersHeadFormQueXMLUrl
is not available. So the question is can
Code:
aSurveyInfo.printAnswersHeadFormQueXMLUrl
be made available (loaded) inside the "Completed" view?

Thank you very much!
The topic has been locked.
More
8 years 1 month ago - 8 years 1 month ago #172519 by tpartner
Maybe file a feature request asking for that to available.

In the meantime, how about inserting the action attribute via JavaScript.

Something like this in submit.twig:

Code:
{{ C.Html.form(aSurveyInfo.printAnswersHeadFormQueXMLUrl, 'post') }} {{ gT("Export these responses to QXML:") }} <button class="btn btn-default" type="submit"> {{ gT("queXMLPDF export") }} </button> {{ C.Html.endForm }} <script type="text/javascript" charset="utf-8"> $(document).on('ready pjax:scriptcomplete',function(){ $('form').each(function(i) { var actionAttr = $(this).attr('action'); if (typeof actionAttr === typeof undefined || actionAttr === false) { $(this).attr('action', '/pathToLimeSurvey/index.php/printanswers/view?surveyid={{ aSurveyInfo.sid }}&printableexport=quexmlpdf'); } }); }); </script>

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 8 years 1 month ago by tpartner.
The following user(s) said Thank You: QuoTil
The topic has been locked.
More
8 years 1 month ago #172531 by QuoTil
I found a solution and solved it as follows without additional js:
Code:
{% if (aSurveyInfo.aCompleted.aPrintAnswers.show == true) %} {% set printQxmlPDF = '/yourPath/index.php?r=printanswers/view&surveyid=' ~ aSurveyInfo.oSurvey.sid ~ '&printableexport=quexmlpdf' %} {{ C.Html.form(printQxmlPDF, 'post') }} {{ gT("Umfrage als PDF exportieren (QXML PDF):") }} <button class="btn btn-default" type="submit">{{ gT("PDF export") }}</button> {{ C.Html.endForm }} {% endif %}
The following user(s) said Thank You: tpartner
The topic has been locked.
More
8 years 1 month ago #172532 by tpartner
Nice!

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
Moderators: tpartner, holch

Lime-years ahead

Online-surveys for every purse and purpose