- Posts: 7
- Thank you received: 0
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
- jbdotingco
- Topic Author
- Offline
- New Member
Less
More
4 years 5 days ago #195705
by jbdotingco
A specific date used as a notification in the help text was created 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?
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.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12779
- Thank you received: 3940
4 years 5 days ago #195706
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic A specific date used as a notification in the help text
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
and the helptext I set to:
<span class="myHelp">xxx</span>
The styling of this message is up to you.
Joffm
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
Attachments:
The following user(s) said Thank You: jbdotingco
The topic has been locked.
- jbdotingco
- Topic Author
- Offline
- New Member
Less
More
- Posts: 7
- Thank you received: 0
4 years 5 days ago #195707
by jbdotingco
Replied by jbdotingco on topic A specific date used as a notification in the help text
Thank you!
The topic has been locked.