Welcome to the LimeSurvey Community Forum

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

queXMLPDF export on Completed view

  • QuoTil
  • QuoTil's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 8 months ago #172507 by QuoTil
queXMLPDF export on Completed view was created 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.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 8 months ago - 5 years 8 months ago #172519 by tpartner
Replied by tpartner on topic queXMLPDF export on Completed view
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 }}&amp;printableexport=quexmlpdf');
      }
    });
  });
</script>

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 5 years 8 months ago by tpartner.
The following user(s) said Thank You: QuoTil
The topic has been locked.
  • QuoTil
  • QuoTil's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 8 months ago #172531 by QuoTil
Replied by QuoTil on topic queXMLPDF export on Completed view
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&amp;surveyid=' ~ aSurveyInfo.oSurvey.sid ~ '&amp;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.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 8 months ago #172532 by tpartner
Replied by tpartner on topic queXMLPDF export on Completed view
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.

Lime-years ahead

Online-surveys for every purse and purpose