Send hidden date in signup form

Hi everyone,

Just thought I would share this with you in case it's useful for anyone.
I needed to send today's date as a custom field when a user signs up, and found out (thanks to Stephen in support!) that you need to send three separate variables - year, month, day.

Here's how I did it using javascript:

<script type="text/javascript">
<!--
var currentTime = new Date()
var month = currentTime.getMonth() + 1
var day = currentTime.getDate()
var year = currentTime.getFullYear()
//-->
document.write('<input type="hidden" name=“cm-xx-xxxxxx-mn" id=“DateAdded-mn" value=' +month+ ' />')
document.write('<input type="hidden" name=“cm-xx-xxxxxx-dy" id=“DateAdded-dy" value=' +day+ ' />')
document.write('<input type="hidden" name=“cm-xx-xxxxxx-yr" id=“DateAdded-yr" value=' +year+ ' />')
</script>
roshodgekiss roshodgekiss, 5 years ago

That's great hoberinos - thank you for sharing this solution, I'm sure many people will find this to be very useful!


Get in touch with us on Twitter: http://twitter.com/campaignmonitor
We're also on Facebook: http://facebook.com/campaignmonitor

See why 200,000 companies worldwide love Campaign Monitor.

From Australia to Zimbabwe, and everywhere in between, companies count on Campaign Monitor for email campaigns that boost the bottom line.

Get started for free