Goodbarry / Business Catalyst - Set Expiry on Secure Zone form - Javascript


/ Published in: JavaScript
Save to your folder(s)

test it with alert(xpires); working well for me. silly goodbarry format


Copy this code and paste it in your HTML
  1. <script type="text/javascript">
  2.  
  3. var d=new Date(); //get today's date
  4. var day=d.getDate() + 8; //add 8 days to today's date
  5. var month=d.getMonth() + 1; //add one to the month bc of 0 start
  6. var year=d.getFullYear();
  7.  
  8. var month=new Array(12); //assign the months strings, match goodbarry's
  9. month[0]="January";
  10. month[1]="February";
  11. month[2]="March";
  12. month[3]="April";
  13. month[4]="May";
  14. month[5]="June";
  15. month[6]="July";
  16. month[7]="August";
  17. month[8]="September";
  18. month[9]="October";
  19. month[10]="November";
  20. month[11]="December";
  21.  
  22.  
  23. var xpires = (day + "-" + month[d.getMonth()].substr(0,3) + "-" + year); //i set a variable called xpires
  24. document.sevenWebinar.ZoneExpiry.value = xpires //write the value of my variable to document.formName.inputName.value
  25. </script>
  26.  
  27. === HTML for FORM ===
  28.  
  29. <form action="....foo..." enctype="multipart/form-data" method="post" name="sevenWebinar">
  30. <input type="username" name="Username" />
  31. <input type="password" name="Password" />
  32. <input type="hidden" name="ZoneExpiry" />
  33. <input type="submit" value="Submit" />
  34. </form>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.