Adding A Date To The Results / Report Page


#1

Hi, Nik

Is there a quick / easy way of adding the date the quiz was completed to the report/results that a person gets?

I just want something that records the day’s date because people will be using the report as a baseline and then going back in 3 months and doing the quiz again.

Any thoughts?

Cheers, Trudy


#2

Hi @Trudy

Yes, possible. :slight_smile:

A simple js script. Will respond shortly with the script.

Nik


#3

Hi Trudy,

Check this out:
https://www.leadshook.com/dtexample/whats-your-real-beauty-age/

See the results page. Are you looking for something like what we’re displaying on results page.

Nik


#4

Hi, Nik

All I can see when I go to that page is …

I’ve tried it on both Chrome and Safari and get the same things.

Cheers, Trudy


#5

Ooops! Sorry

Unactivaated DT.

Direct link version:

https://marketing.leadshook.io/survey/2AYwOQY56flLaYdST5UqvPpu0N54et9S0H3stNqW?preview=true

Nik


#6

Thanks, Nik

Yes, that’s exactly the sort of thing I’m looking for :slight_smile:

Cheers, Trdy


#7

@Trudy,

Instructions in video and copy of script to use.

Nik

Video: https://youtu.be/ZuaHNZ0SnPg

<p id="date" name="date"><script>
	const monthNames = ["January", "February", "March", "April", "May", "June",
  "July", "August", "September", "October", "November", "December"
];
n =  new Date();
y = n.getFullYear();
m = n.getMonth() + 1;
d = n.getDate();
date = monthNames[n.getMonth()] +" "+ d + ", " + y;
document.getElementById("date").setAttribute('ng-init','inputs.date="'+date+'"'); 
</script></p>

#8

Hi, Nik

It works … as long as the quiz is deactivated. For some reason, as soon as I activate it, it stops showing the date.

Any suggestions?

Cheers, Trudy


#9

Hi Trudy,

Oops! I’m sorry. The script needed some adjustment. Please try this one.

<p><input id="date" name="date" style="display:none;" type="text" /></p>
<script>
 var monthNames = ["January", "February", "March", "April", "May", "June",
 "July", "August", "September", "October", "November", "December"
];

var n = new Date();
var y = n.getFullYear();
var m = n.getMonth() + 1;
var d = n.getDate();
var date = monthNames[n.getMonth()] + ' ' + d + ', ' + y;
var setDate = setInterval(function () {
 if (typeof $ === 'undefined') return;
 var $date = $('.app #date')
 if($date.length > 0 && !$date.val()) {
   $date.val(date).trigger('change');
   clearInterval(setDate);
 }
}, 500);
</script>

#10

Thanks, Nik

Works like a charm :slight_smile:
Cheers, Trudy