Welcome to the LimeSurvey Community Forum

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

A specific date used as a notification in the help text

More
6 years 6 months ago #195705 by jbdotingco
Need help of using a specific day of the week as a notification text in the help display of date variable.

Example, a survey is conducted every day and at the end of the week (example: Friday), some variables are needed to be filled up by the participant for the weekly updating while not required in other days of the week.

So is there a solution of notifying the participant through a help text of a date (Thursday) that tomorrow is Friday and a weekly report is due while he is updating the record on a Thursday?
The topic has been locked.
More
6 years 6 months ago #195706 by Joffm
Hi,
as you know, there is no function "dayofweek" or so in LS.
So I used a bit javascript.
There is the function Date.getDay() to get the dayofweek out of a date.
www.w3schools.com/jsref/jsref_getday.asp
Code:
<script type="text/javascript" charset="utf-8"> $(document).on('ready pjax:scriptcomplete',function(){ var d = new Date(); var dow=d.getDay(); if (dow==4) { $(".myHelp").text("Tomorrow is Friday"); } else { $(".myHelp").text(""); } }); </script>

and the helptext I set to:
<span class="myHelp">xxx</span>





The styling of this message is up to you.

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: jbdotingco
The topic has been locked.
More
6 years 6 months ago #195707 by jbdotingco
The topic has been locked.
Moderators: tpartner, holch

Lime-years ahead

Online-surveys for every purse and purpose