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+ ' />')
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:
We're also on Facebook:

Join 150,000 companies around the world that use Campaign Monitor to run email marketing campaigns that deliver results for their business.

Get started for free