Welcome to the LimeSurvey Community Forum

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

Javascript information disapears in report.

  • LimeRay
  • LimeRay's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 11 months ago #167232 by LimeRay
Hi,
I am trying to add some dynamic text to the report I am sending to all participants in one of our surveys. I want the mail to contain some graphics and text.
When I put the "report" on the screen prior to sending the information everything looks exactly as it should but when the report arrives in the email that information has disapeared... hasn't been rendered.

That is regardless of if I am trying to use sendPDFReport or just sending the confirmation mail. My prefered choice is sendPDFReport but I take whatever solution I can get ;-)

I found this little code when I searched
Code:
<!-- The static text -->
<p>This is some static question text...</p>
 
<!--  A container for the dynamic text -->
<div id="elementToBeLoaded"></div>
 
<!-- A script to insert the dynamic text -->
<script type="text/javascript" charset="utf-8">
  $(document).on('ready pjax:complete',function() { 
    $('#elementToBeLoaded').load('http://example.com #remoteContentToLoad');
  });
</script>

and that works well for showing on screen but disapears when I try to make sendPDFReport or normal confirmation mail.
Thank you!
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 11 months ago #167270 by tpartner
Replied by tpartner on topic Javascript information disapears in report.
JavaScript works client-side in a browser, not in an email or PDF.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • LimeRay
  • LimeRay's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 11 months ago #167282 by LimeRay
Replied by LimeRay on topic Javascript information disapears in report.
Thank you for the answer!
It was what I expected unfortunately:-(

Then I have another question, is it possible to reference a
php page to populate information in the confirmationmail like the sample.
Please bear in mind I'm not a programmer if there was a doubt:-)
Code:
{if(Q1 == 'Y', include information from php-file, 'Some standard text')}
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 11 months ago #167288 by tpartner
Replied by tpartner on topic Javascript information disapears in report.
Not directly.

I suppose it might be possible to use JavaScript/AJAX to load a hidden long-text question with the contents of a PHP file and then access that via Expression Manager in the email... but that would require a fair amount of development and testing.

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