EDG28 Posted April 3, 2017 Report Share Posted April 3, 2017 Ask : How to get previous year in submission form using JS Quote Link to comment Share on other sites More sharing options...
Ba2sai Posted April 3, 2017 Report Share Posted April 3, 2017 Hi EDG28, Try this: Get two virtual fields in your submit form then add the script in your footer. <SCRIPT LANGUAGE="JavaScript"> function dateLastYear(){ var currentDate= new Date(); var MonthNow = currentDate.getMonth(); var DayNow = currentDate.getDate(); var YearNow = currentDate.getFullYear(); var currentYear = currentDate.getFullYear(); var previousYear = currentYear - 1; document.getElementById('cbParamVirtual1').value = (MonthNow+1) + "/" + DayNow + "/" + YearNow; document.getElementById('cbParamVirtual2').value = (MonthNow+1) + "/" + DayNow + "/" + previousYear; } document.getElementById("Submit").onmouseover=dateLastYear; </SCRIPT> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.