Dynamic Default Value for Date/Time Field



I am creating a form for applicants to a selective program.  To be competitive for selection, applicants need to have worked in our industry for 3-7 years after graduating with their bachelor's degrees.  I want the user-entered graduation date field (Date/Time field type) to default to a value that is roughly 5 years (1825 days) before the date in which they are entering the data, and I want the user to see an empty field until they select it to enter their graduation date.  Initially, I created a static default value in the "Value" tab, but that value is displayed when the form is generated, which I don't want.  Then I tried adding the following code to the "enter" event of my graduation date field, but it also didn't help:

form1.#subform[0].ServiceDate::enter - (JavaScript, client)

if (this.rawValue == null){

  this.rawValue = (d.getDate() - 2190);


I appreciate any recommendations.  Thanks!

View Entire Topic



I tried moving it to the initialize event, but the dropdown calendar still started in 2019, even though the date displayed in the field was 9 Jan 14.  If I manually enter 01/09/14 in the field, then the dropdown calendar begins with 9 Jan 2014.