- Posts: 3
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Expressions within HTML tags
- jessfishenden
- Topic Author
- Offline
- New Member
Less
More
7 years 11 months ago #133761
by jessfishenden
Expressions within HTML tags was created by jessfishenden
Hello,
Can't tell whether this is a bug, or whether I'm missing a crucial element or escape character.
I want to dynamically generate the contents of a 'src' or 'href' variable inside an html tag, for example:
The Expression in curly brackets seems to deal fine with being within the double quotes, but breaks when I add the < and > - the expression output (the 'year' variable in this example) gets changed into something like
Note this has also changed my input date from the original year to the unix epoch origin.
I'm running LS Version 2.06+ Build 150731
I have a live version of a survey that demonstrates the problem here, and the exported survey is also attached.
www.woodhousecommunitycentre.com/surveys...php/399574?newtest=Y
Any insight would be very much appreciated - is this a bug, or am I just missing something?
Can't tell whether this is a bug, or whether I'm missing a crucial element or escape character.
I want to dynamically generate the contents of a 'src' or 'href' variable inside an html tag, for example:
Code:
<a href="http://website.com/day.php?year={date('Y',strtotime(oneoffdate))}&month={date('m',strtotime(oneoffdate))}&day={date('d',strtotime(oneoffdate))}&area=3">LINK</a>
The Expression in curly brackets seems to deal fine with being within the double quotes, but breaks when I add the < and > - the expression output (the 'year' variable in this example) gets changed into something like
Code:
<span id="LEMtailor_Q_238_64">1970</span>
I'm running LS Version 2.06+ Build 150731
I have a live version of a survey that demonstrates the problem here, and the exported survey is also attached.
www.woodhousecommunitycentre.com/surveys...php/399574?newtest=Y
Any insight would be very much appreciated - is this a bug, or am I just missing something?
Attachments:
The topic has been locked.
- holch
- Away
- LimeSurvey Community Team
Less
More
- Posts: 11757
- Thank you received: 2753
7 years 11 months ago #133767
by holch
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Replied by holch on topic Expressions within HTML tags
First of all, you need to make sure that your survey can use HTML (switch off the XSS filter) because it seems like Limesurvey is substituting the HTML codes.
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
The topic has been locked.
- holch
- Away
- LimeSurvey Community Team
Less
More
- Posts: 11757
- Thank you received: 2753
7 years 11 months ago #133768
by holch
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Replied by holch on topic Expressions within HTML tags
But there is more going on. The EM codes work fine when outside of HTML, but when placed within the link, they get substituted by spans.
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13935
- Thank you received: 2551
7 years 11 months ago #133781
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic Expressions within HTML tags
Only if oneoffdate is on same page , no ?holch wrote: But there is more going on. The EM codes work fine when outside of HTML, but when placed within the link, they get substituted by spans.
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
- jessfishenden
- Topic Author
- Offline
- New Member
Less
More
- Posts: 3
- Thank you received: 0
7 years 11 months ago #133804
by jessfishenden
Replied by jessfishenden on topic Expressions within HTML tags
You're right! It works if it's on the next page.
Works regardless of XSS setting.
Unfortunately it's not much use to me if people have to click back and forth between pages.
Most other use of expressions can work fully on the same page, as these date elements do outside of the tag.
I can't tell what makes the difference!
Works regardless of XSS setting.
Unfortunately it's not much use to me if people have to click back and forth between pages.
Most other use of expressions can work fully on the same page, as these date elements do outside of the tag.
I can't tell what makes the difference!
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13935
- Thank you received: 2551
7 years 11 months ago #133812
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic Expressions within HTML tags
If it's on same page : we need a way to update when user update oneoffdate.
Then we must add something .....
You can not do different
For your purpose :
Then we must add something .....
You can not do different
For your purpose :
Code:
<a id="toto" name="toto">The link</a> <span id="totolink" style="display:none">http://website.com/day.php?year={date('Y',strtotime(oneoffdate))}&month={date('m',strtotime(oneoffdate))}&day={date('d',strtotime(oneoffdate))}&area=3</span> <script> $("#toto").on("click",function(){ window.location.href=$("#toto").text(); }); </script>
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
- jessfishenden
- Topic Author
- Offline
- New Member
Less
More
- Posts: 3
- Thank you received: 0
7 years 11 months ago #133818
by jessfishenden
Replied by jessfishenden on topic Expressions within HTML tags
I'm very unfamiliar with javascript, but it looks like that's the only way.
That code does make sense, though, thanks for the help.
I'm happy to implement a workaround to make this work, but it still feels like a bug to me, do you think it needs to be reported as one?
That code does make sense, though, thanks for the help.
I'm happy to implement a workaround to make this work, but it still feels like a bug to me, do you think it needs to be reported as one?
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13935
- Thank you received: 2551
7 years 11 months ago - 7 years 11 months ago #133843
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic Expressions within HTML tags
Hi,
You can report if you want (sometimes my english seem unclear ). But it's not a bug.
- User can update his answer in same page
- Then we must update it in the page.
If we set {date('m',strtotime(oneoffdate))} to 2015 without a span : there are no difference with another 2015 in same page. Then we can not easily update it [* see example].
It's more a big dev/feature request, maybe 3.1/3.2 have a system to load the question content in ajax : but then i think it take a lot mlore time when the user click on another answer.
*
You use set to
No human can see the difference betwwen the 2 2015 => computer can not too.
Denis
You can report if you want (sometimes my english seem unclear ). But it's not a bug.
- User can update his answer in same page
- Then we must update it in the page.
If we set {date('m',strtotime(oneoffdate))} to 2015 without a span : there are no difference with another 2015 in same page. Then we can not easily update it [* see example].
It's more a big dev/feature request, maybe 3.1/3.2 have a system to load the question content in ajax : but then i think it take a lot mlore time when the user click on another answer.
*
You use set to
Code:
2015 or 2015
Denis
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Last edit: 7 years 11 months ago by DenisChenu.
The topic has been locked.