Developer forum

Forum » Templates » Year selection in Data Management Forms

Year selection in Data Management Forms


Reply

On my dynamicweb site I use the “Data Management - Forms” module which creates a form based on a table in the Database. In my table I use an date field (birthdate), in my form I signed this field as an date-type and in my page you can see an date selector(3 selectlists for day, month and year).

But now my question: The year only goes back to 1990 so people who are born before that cannot fill in their birthdate. I hope this is just some configuration somewhere but I haven’t found it yet.

Can anyone tell me where to change this?

Regards,
Tom

Replies

 
Nicolai Høeg Pedersen
Reply
The system starts dates from 1990... Only way to change it is using a javascript....

Just made a bug item so that the select will start from 1900
 
Reply
I fixed it by using jQuery (assuming javascript is enabled)



 $(document).ready(function(){
        var d = new Date();
        $('#Birthdate_year').empty()

        //add options
        for (var i = d.getFullYear(); i >= 1900; i--) {
            $('#Birthdate_year').prepend(''+i+''); 
        }

        //reinit calendar
        Calendar.setup({
          inputField: "Birthdate_calendar",
          ifFormat: "%Y-%m-%d %H:%M",
          onUpdate: function(cal){Calendar.onUpdateDW(cal, "Birthdate", true); }, button: "Birthdate_calendar_btn",
          range: [1900, d.getFullYear()]
        });
});

 

You must be logged in to post in the forum