Automatically set expiry date on Secure Zone in Business Catalyst04-Feb-2011 I have been struggling with this for days and the forums on Business Catalyst are piecemeal so I thought I would put the solution here for my own reference and for anyone else that maybe stuggling.
I want to subscribe a user to a secure zone for only 12 months but instead of doing it manually I want to automatically set an expiry date when they fill in the signup form.
SolutionInsert this code into the form somewhere, it just needs to be between the form tags. Keep the value="1-Oct-2008" as this gets overwritten.
<input type="hidden" value="1-Oct-2008" name="ZoneExpiry" id="ExpiryDate"/>
This code needs to go at the bottom of the page. The "+ 365" part can be set to however many days out you want the expiry to be.
function setExpiryDate( )
var dat=new Date();
dat.setDate(dat.getDate() + 365);
var monthname=new Array("Jan","Feb","Mar","Apr","May","Jun", "Jul","Aug","Sep","Oct","Nov","Dec")
var pretty = dat.getDate() + "-" + monthname[dat.getMonth()] + "-" + dat.getFullYear();
document.getElementById("ExpiryDate").value = pretty;
The code on these pages is not clear.