2 Replies Latest reply on Jan 8, 2012 12:47 PM by CDesign2

    Default year in Date field

    CDesign2

      Hi I am creating a Date of Birth field in a form and was wondering if there was a way to alter the deafult year. Most users will be at least 25 so it would make sense to have my date drop down show you 1987 (for example) when it drops downs so that users don't have a far back to navigate.  Is this possible?

       

      Thanks

        • 1. Re: Default year in Date field
          Varma_LC Level 3

          here is a generic script that might help you.... I used this JavaScript in 'docReady' event of the Year dropdown...

          if (this.rawValue == null || this.rawValue == "") {

              var d = new Date();

              var setValue = d.getFullYear() -25;

              this.rawValue = setValue;

          }

          • 2. Re: Default year in Date field
            CDesign2 Level 2

            Thank you, that does just what I want. 

             

            The only little change I would like to make (if possible) is that I would like the DATE field to display empty when the form is first opened.  Is that possible? or do you need the date displayed to make the drop down to understand to show a date 25 years ago?