Welcome, Guest
Username: Password: Remember me

TOPIC: EM substitutions use <span> on same page - can any be static instead?

EM substitutions use <span> on same page - can any be static instead? 2 years 5 months ago #77960

  • TMSWhite
  • TMSWhite's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 759
  • Thank you received: 82
  • Karma: 36
For those who have played with EM suffixes, you have probably seen that if they refer to variables on the same page, they always generate a <span> element. For example,
{input.SGQA}

Yields this if on the same page:
<span id='LEMtailor_Q_521_35'>24235X25X521</span>

But this if on a different page:
24235X25X521

This has led to challenges like the one discussed in this thread, where attempts to get the sgqa code on the same page were temporarily stymied by the dynamic substitution feature.

Perhaps some of those question metadata should be statically substituted even when on the same page. The logical option would be to allow static substitution for anything that could not be dynamic. So, it might make sense to upgrade the substitution engine to do the following:

(1) Continue to make these dynamic:
SUFFIXSUBSTITUTION_TYPE
(no suffix)dynamic
codedynamic
NAOKdynamic
relevanceStatusdynamic
showndynamic
valuedynamic
valueNAOKdynamic

(2) But make these static, even when on the same page:
SUFFIXSUBSTITUTION_TYPE
gidstatic
grelevancestatic
gseqstatic
jsNamestatic
mandatorystatic
qidstatic
qseqstatic
questionstatic
readWritestatic
relevancestatic
rowdividstatic
sgqastatic
typestatic

The only down-side of using static substitution is that if you wanted to use {q.question} to show the text of a question, but you wanted to hide that value if the question was irrelevant, you would need to use the following instead:
{if(q,q.question,'')}

At present, if q is irrelevant, q.question would not be shown at all.

Thoughts from the developers and broader community?
The administrator has disabled public write access.

Re: EM substitutions use <span> on same page - can any be static instead? 2 years 5 months ago #77972

  • c_schmitz
  • c_schmitz's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 784
  • Thank you received: 112
  • Karma: 92
Hi

But how about a suffix-suffix instead that signals that a certain variable is displayed statically.

like
q.question.static
Support us, too. Donate to the LimeSurvey project and help keep us going!
Last Edit: 2 years 5 months ago by c_schmitz.
The administrator has disabled public write access.

Re: EM substitutions use <span> on same page - can any be static instead? 2 years 5 months ago #77973

  • DenisChenu
  • DenisChenu's Avatar
  • OFFLINE
  • Moderator Lime
  • Posts: 6338
  • Thank you received: 818
  • Karma: 243
With this solution,

You put < span > at all value that can change, and static for static value.


Maybe there are some problem (or not) with some static :
For example :
q.question : if the q.question have some anotherq.value, then according to the static/synamic you have:
The answer of the another question is <span id='LEMtailor_Q_521_35'>the answer</span>
and it's OK.

I just see this one, but maybe there are another
The administrator has disabled public write access.

Re: EM substitutions use <span> on same page - can any be static instead? 2 years 5 months ago #77975

  • TMSWhite
  • TMSWhite's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 759
  • Thank you received: 82
  • Karma: 36
I had toyed with other suffix-suffixes too. For example, instead of having .valueNAOK, we could just have .NAOK as a suffix. That way you could do
q.question.NAOK

which would mean to show the question even if it is irrelevant. That would also let us get rid of
q.valueNAOK

and change it to
q.value.NAOK

However, I'm not sure we really need a .static suffix. I'm leaning to thinking that non-potentially-dynamic values should never be encased in a <span> tag. And if that is the case, .static couldn't work on a dynamic value anyway (unless we somehow wanted to keep the first value and not let it change - but that is a whole different matter).
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.516 seconds
Donation Image