How to only make current year active in date field


how to only make current year active in date field

Thank you,


Hello @r_pat,

You can specify the minimum and maximum date, which the calendar can show:

fd.field('Date').widgetOptions = {

    min: new Date(2020, 0, 1),
    max: new Date(2020, 11, 31)

And also add a custom validation to prevent submitting form when the date is out of the range.

        name: 'DateValidation',
        error: "Text",
        validate: function(value) {
            if (fd.field('Date').value > new Date(2020, 11, 31)) {
                   return false;
            if (fd.field('Date').value < new Date(2020, 0, 1)) {
                   return false;
            return true;

thank you that worked and helped.

quick question, is there a way to do a check and change the date automatically instead of hard coding the date/year?


you can add an onchange event, to check the date and change it to a pre-specified date, like this:

fd.field('Date').$on('change', function(value){
    if(value > new Date(2020, 11, 31) || value < new Date(2020, 0, 1)){
        fd.field('Date').value = new Date();