Welcome to the LimeSurvey Community Forum

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

Search Results (Searched for: html)

  • Joffm
  • Joffm's Avatar
03 Jun 2024 23:23 - 03 Jun 2024 23:28
Hi, I used the example shown in the bootstrap docs.
[url] getbootstrap.com/docs/5.3/components/popovers/ [/url]
As said there 
[url] getbootstrap.com/docs/5.3/content/images/ [/url]
Images in Bootstrap are made responsive with .img-fluid.

So set the popover container to the desired width and enter your images with class="img-fluid".
But in your css set the width to 25% (four images)

width of popover: 400px
 

width of popover: 800px
 

Better use the source code editor to enter the code. The HTML editor seems to spoil it.
Code:
<span data-bs-content='<img src="https://www.mysurvey.de/userfiles/Hamburg-Ballett_02.jpg"  class="img-fluid" ><img src="https://www.mysurvey.de/userfiles/Hamburg-Ballett_05.jpg"  class="img-fluid"><img src="https://www.mysurvey.de/userfiles/Hamburg-Ballett_16.jpg" class="img-fluid" alt=""><img src="https://www.mysurvey.de/userfiles/Hamburg-Ballett_10.jpg" class="img-fluid"  alt="">' data-bs-toggle="popover" data-bs-trigger="hover focus" data-bs-placement="right" data-bs-html="true" >Ballett Scenes </span>
 
<script>
$(function () {
  $('[data-bs-toggle="popover"]').popover();
});
</script>
 
<style type="text/css">
.popover {
  max-width:800px;
}
.img-fluid {
  max-width:25%;
}
</style>


Joffm
I hope I did not misunderstand.
  • dqzhou
  • dqzhou's Avatar
03 Jun 2024 20:51
Please help us help you and fill where relevant:
Your LimeSurvey version: Version 6.5.9 
Own server or LimeSurvey hosting:
Survey theme/template:
==================
Hi,

I am considering to put the picture into the explanation box of clickable words. For insert text into explanation box, i use the following code which is fine:

<a data-bs-content="xxxxxx" data-bs-placement="top" data-bs-toggle="popover" data-bs-trigger="hover focus" role="button" tabindex="0" title="xx">xx </a> <script>
$(function () {
  $('[data-bs-toggle="popover"]').popover();
});
</script>

But this code is difficult to add the picture into it. I use the following code, which cannot adjust the size of picture. It is showed in the attached picture.

<a data-bs-content="&lt;img  data-cke-saved-src='/upload/surveys/411885/images/parcelsize_ENG.png' src='/upload/surveys/411885/images/parcelsize_ENG.png' style='width: 10px; height: 10px;' /&gt;" data-bs-placement="top" data-bs-toggle="popover" data-bs-trigger="hover focus" id="popoverTrigger" role="button" tabindex="0">Parcel size</a> <script>
  // Initialize popover
  var popoverTrigger = document.getElementById('popoverTrigger');
  var popover = new bootstrap.Popover(popoverTrigger, {
    html: true
  });
</script>
 
Can you help me to solve this problem?
  • linuxhooligan
  • linuxhooligan's Avatar
03 Jun 2024 14:25
Aha! Okay, updates.

For any noobs getting up to speed, here is what you should keep in mind:

1) Install pdfReport and limeMpdf using the plugin manager.

2) Import the sample survey from the pdfReport demo folder.

Everything will work perfectly on Lime survey 5.x, there are no actual issues. Where I as a novice had to work a little bit is figuring out where the important components are that tweak the behaviour in various ways. For example:

* Setting the survey to "allow users to print answers' is one important feature.

* Setting the "Replace public print answer" in the report question is also important.

* Setting the Email reply templates is useful as well.

* It is also important tor realize that the file upload question is what is used for the report and this is where you generate your report.

* You can create a basic report using the question html editor on the page, but if you have limeMpdf plugin installed, you can construct a whole report using a set of supported Bootstrap html tags, text and expression script.

* The PDF help file is incredibly well documented and provides excellent references for what is possible.

* Of course, you have to setup your email settings successfully in Global Settings in order for the pdf to be attached and emailed.

Once setup, everything works perfectly.

Denis and team, this is an amazing set of plugins. Please ignore my post just prior to this one, I did not fully understand that those questions referred to settings in the sample survey provided. That was a perfect demo of what can be done and I have it working as we need it on a new survey just great.

Very much appreciate this plugin, this solved a huge challenge for us.
  • linuxhooligan
  • linuxhooligan's Avatar
03 Jun 2024 12:14
Aha!

1) Okay, I will review that.

2) Email + pdf:

a) My LimeSurvey version: Version 5.6.55+240220

b)  Here is what the email looks like in my inbox:   

You will note the default template text at the top and the html report under neath it inthe body of the mail.
  • linuxhooligan
  • linuxhooligan's Avatar
03 Jun 2024 11:56 - 03 Jun 2024 11:58
No issue at all.  The error was on my side.

The pdfReport and limeMpdf plugs work kind of amazing actually.  Having the report emailed to the user is an incredible feature. 

Questions:

1) When running the demo reportPDF survey is activated and I run it, the first page shows an error:  "Email is deactivated on this instance".  The demos survey mails out the pdf as an attachment just fine and I don't see any settings on the system that might cause the issue.  Any thoughts on what might cause this and how to resolve it?

Screenshot:  

2) Where do I control the email that is being sent out?  Details:

a) I get two emails to the mailbox using the demo tmeplate: 

* Response submissions
* Confirmation email + pdf attachment.

I would like to:

* Only send out the confirmation email + pdf attachment
* Not include the pdf report in the body of the email, only a confirmation text + an attachment.

The confirmation email is setup correctly in the EMAIL TEMPLATES section of the survey but both emails sent to the user contain the HTML report in the body of the email underneath the confirmation email body configuration.

Suggestions on where to look?  I have googled, read the manuals and searched forums, not quite sure where to find that configuration.

Link to sample survey for reference:   

File Attachment:

File Name: limesurvey...2154.lss
File Size:34 KB


Thank you kindly.
  • DenisChenu
  • DenisChenu's Avatar
30 May 2024 08:19

However, the "!" icon remains. Is it possible to hide the "!" icon?
 
Sorry, i'm unclear about where to put it :). You get it it was in tip.

Else :

1. Report the issue
2. Maybe you can such solution in custom.js

gitlab.com/SondagesPro/SurveyThemes/skel...?ref_type=heads#L103
Code:
        $(document).on("html:updated", ".em_sq_fn_validation, .em_q_fn_validation", function () {
            if ($.trim($(this).text())) {
                $(this).removeClass("hidden");
            } else {
                $(this).addClass("hidden");
            }
        });
Not tested in last version
 
  • linuxhooligan
  • linuxhooligan's Avatar
27 May 2024 09:48
Replied by linuxhooligan on topic Storing and returning HTML formatted text.
Very much appreciate everyones suggestions. I will do HTML report and my nest step is to look into pdfReport as well.

I hope this helps other noobs as well when they search.

Thank you for your time.
  • DenisChenu
  • DenisChenu's Avatar
27 May 2024 09:25 - 27 May 2024 09:27
Replied by DenisChenu on topic Storing and returning HTML formatted text.
> What does this mean? Does Limesurvey have an ability to use variables?

Answer part : variable to be exported, and variable without HTML.

You can use MyQuestion.question for variable too : HTML allowed, no data saved, more clean.

I do HTML report since years now. It's really more easy to work with .question than with .NAOK.

But you can do what you want … it's just advice …

> The logical way to do this is to collect the totals and store them in one questions. Store the answers (perhaps with html formatting) in another question, store various triggers in a third question and then on the report page compose the final report using THIS_that_value.

When i need this : i use some text display question, and after a final report

{if(Q01.NAOK,Report1.question)}{if(Q02.NAOK,Report2.question)}

etc …
  • linuxhooligan
  • linuxhooligan's Avatar
26 May 2024 07:00
Replied by linuxhooligan on topic Storing and returning HTML formatted text.
Amazing feedback, including the critiques. Just to answer this question:

"Why do you expect to get something else than plain text like '<span style="color:red"><b>Tralala</b></span>'"

You are correct, I expect Lime to consider entries in questions as strings. As per recommendation html_entity_decode(x) is precisely what I was looking for.

Thank you for that.

Denis said the following: 1. I really never try to put HTML in answers part

What does this mean? Does Limesurvey have an ability to use variables? All of the examples that I have seen so far use questions to store data and later perform operations on this data in various ways. Denis, are you saying there is another way to store data?

I have a survey with about 200 questions and the final page needs to take the data and:

* Sort 30 possible options into 4 categories.
* Only show the questions in the category they score in.
* Display the 4 categories (of up to 30 possible options each) in a nice way which requires, divs, css classes and as little parsing and appending using join as possible because that is impossible to debug and maintain.

The logical way to do this is to collect the totals and store them in one questions. Store the answers (perhaps with html formatting) in another question, store various triggers in a third question and then on the report page compose the final report using THIS_that_value.

Is there a better way to do this?
  • Joffm
  • Joffm's Avatar
25 May 2024 17:22
Replied by Joffm on topic Storing and returning HTML formatted text.
Fully agreed, @Denis.

One more word.
Why do you expect to get something else than plain text like '<span style="color:red"><b>Tralala</b></span>'
LimeSurvey doesn't know that you want to use inline css.
It's a text answer like everything else.
In a test it could be the answer to questions like
"Please enter the inline css to display the word "Tralala" in bold and red."
"Which HTML tag is used for an inline container?"
In these cases you obviously do not want the answer to be rendered.

Therefore you have to tell that it is displayed as HTMl code.

Joffm
  • DenisChenu
  • DenisChenu's Avatar
25 May 2024 14:05
Replied by DenisChenu on topic Storing and returning HTML formatted text.
1. I really never try to put HTML in answers part
2. I always deactivate HTML editor for complex part
3. I use multiple Question type - Text display when it's complex
4. If filterxsshtml is activated : i can not start a tag but not close on same function
5. If filterxsshtml is activated : i can not use html_entity_decode
  • Joffm
  • Joffm's Avatar
25 May 2024 04:24
Replied by Joffm on topic Storing and returning HTML formatted text.
You have to use
"html_entity_decode(x)"
[url] manual.limesurvey.org/ExpressionScript_-...mplemented_functions [/url]

Several threads about this
[url] forums.limesurvey.org/forum/can-i-do-thi...xt-nested-conditions [/url]





Nevertheless: Did you consider pdfReport?
And you should use classes.

Joffm

P.S.
If you enter code, please use the "code" button of the editor.
It's easier to read.
  • linuxhooligan
  • linuxhooligan's Avatar
25 May 2024 04:03 - 26 May 2024 07:25
Replied by linuxhooligan on topic Storing and returning HTML formatted text.
For reference point, if anyone has not yet tried to do inline styling, here is what a basic two factor (testing for two personality traits) last page report might look like:
Code:
 
<div style="border-radius: 25px;border: 2px solid #73AD21;padding: 20px;">
 
{join(
 
 
 
if(VAR_adaptability>27,join(
 
'<span style="font-weight',
':',
'bold;">',
'ANXIETY - Your score is: ',
VAR_anxiety,
'</span>',
 
'<br />',
 
'<span style="font-style',
':',
'italic;">',
'A brief description.',
'</span>',
 
'<br />',
 
'<span style="font-style',
':',
'font-size:16px;">',
'Another supplementary description.',
'</span>',
 
'<br /><br />'
 
),''),
 
 
if(VAR_anxiety>27,join(
 
'<span style="font-weight',
':',
'bold;">',
'ANXIETY - Your score is: ',
VAR_anxiety,
'</span>',
 
'<br />',
 
'<span style="font-style',
':',
'italic;">',
'A brief description.',
'</span>',
 
'<br />',
 
'<span style="font-style',
':',
'font-size:16px;">',
'Another supplementary description.',
'</span>',
 
'<br /><br />'
 
),''),
 
)}
 
</div>
 

Please note that it is spaced vertically like that for "maintainability" as developing a somewhat complicate survey requires that the actuall expression script be documented somewhere and made easy to update + copy paste back into the web interface.

However, if you pay attention to the substantial amount of apppend required for the join to to create the proper <span style=".."> tags without triggering parsing errors in Limesurvey makes something like this EXTREMELY unwieldy.

This is a live example of WHY I wanted to just shove a whole bunch of html tagged content into an Array Text question and then just be able to do VAR_item to have it display properly. That would be much easier to maintain.

For any noobs out there looking for examples on how to use join in a slightly more complicated way, this example here is pretty good.  It is based on the example from this page:  manual.limesurvey.org/ExpressionScript_examples
  • linuxhooligan
  • linuxhooligan's Avatar
24 May 2024 23:21 - 25 May 2024 00:18
Replied by linuxhooligan on topic Storing and returning HTML formatted text.
Here is a small example of what I am trying to do:

<p>{join(if(VAR_adaptability>27,VAL01adaptability,''),if(VAR_anxiety>27,VAL02anxiety_SQ001,''),if(VAR_artappreciation>27,VAL03artappreciation,''))}</p>

I am:

1) I am using an Array Numbers question to store the numeric results of a quiz.

2) I am using an Array Text question to store the text values of responses that I want to provide based on the results of the test.

3) In the provided code sample, I do a test for each test item:

a) If test item (VARitem) is greater than 27 return (VALitem) otherwise return nothing.

b) VARitem refers to the array numbers question. VALitem refers to the array text question.

4) What I was expecting to be able to do is embed <b> <i> <div> tags as necessary in order to style up text stores in VALitem.

Currently I have to do it manually inside '<b>this</b><i>that</i>' and limesurvey seems to actually have problems parsing anything other than plain text inside of ' '. For example:

{join(if(VAR_adaptability>27,'<br>this</b><i>that</i>',''),if(VAR_anxiety>27,VAL02anxiety_SQ001,''),if(VAR_artappreciation>27,VAL03artappreciation,''))}

The reason that I am trying to store html is that the top statement is much easier to debug than the bottom expression script statement.  The bottom expression script also has problems parsing and rendering depending on the tags used, I have not figured out yet what the specific cause of the issue might be.

5) Here is what actually happens:

a) Lets say I want to store some html formatted text into an array text question as follows:  {VARarraytext_SQ001_2='<span style="border-radius:25px;background:#73AD21;padding:20px;width:200px;height:150px;">asdfasdf asdfasadf </span>'}

b) Let's say that I want to present that html formatted text on a page with: {VARarraytext_SQ001_2}

c) I get the following result with the text encapsulated in html (which makes sense, I am not complaining): <p><span style="border-radius:25px;background:#73AD21;padding:20px;width:200px;height:150px;">asdfasdf asdfasadf </span></p>

QUESTION: Is it possible to store html tags in array text questions or do i have to manually style up the answers like in the code sample here in point #4?
  • DenisChenu
  • DenisChenu's Avatar
24 May 2024 09:45
Replied by DenisChenu on topic Storing and returning HTML formatted text.
Where did you return the HTML ?
How did you return the HTML ?

Why you need to store HTML ?

A solution is to construct your HTML directly in the content of a question and use {MyQuestion.question} in end page, for example.

Do you know gitlab.com/SondagesPro/ExportAndStats/pdfReport ?
Displaying 61 - 75 out of 4819 results.

Lime-years ahead

Online-surveys for every purse and purpose