Allowing User to select year and month in datepicker

Hi,

In JQuery there is option to allow user to pick year and month.

Is it possible to allow this?

In Jquery we have somthing like this.

$(".a.date").datepicker({

changeMonth: true,

changeYear: true,

yearRange: 'c-20:c+30'

});

Looking ahead to hearing back.

thanks,

Raju

Awesome!!! Thanks! Works perfectly for birth date especially!

glad it works for you

I do see it now and I am Happy can't thank you enough winner !!!

You will see something like below once you change the javascript.


Enrico,

Javascript that I have posted earlier was for a specific control only which has class "a". Do not worry, if you are not familiar with JQuery syntax.

I just looked into your test page, if you are looking for setting default for all datepicker, you can do as follow.

Here's the full javascript code

------------------------

$(document).on('knack-page-render.any'

, function(event, scene) {

$.datepicker.setDefaults({changeMonth: true,changeYear: true, yearRange: 'c-10:c+40'});

});

------------------------


Must be me I guess, or that i can't see it, am using Chrome latest also Tried FF


Saved after inserting

https://beikebiotech.knackhq.com/agetst#home/


Enrico,

It works, please make sure you added this code under API&Code > Javascript. You have to call it when page renders.

Here's the full javascript code

------------------------

$(document).on('knack-page-render.any'

, function(event, scene) {

$(".a.date").datepicker('option',{

changeMonth: true,

changeYear: true,

yearRange: 'c-20:c+30'

});

});

------------------------

no longer seems to work, only can select months

I am able to fix this

corrected javascript is

$(".a.date").datepicker('option',{

changeMonth: true,

changeYear: true,

yearRange: 'c-20:c+30'

});