Skip to main content

Hi,

We have in issue with Date Picker control on Nintex Form.  The year range is displayed on the form is for the last 10 years only. If we select a year it then goes back to another 10 years.  How can I change the year range to display last 100 years by default?

Out Nintex form version is 2.3.3.1 and we run it on SharePoint 2013.

Thanks

Tony

you can configure it, but only with a javascript

NWF.FormFiller.Events.RegisterAfterReady(function(){
   NWF$('#' + dateCtrl).datepicker('option',{
       yearRange: "-50:+50",
   })
})

Thanks so much.  It worked for me.


Great!

Please mark the question answered.


This is exactly what I needed!

In my case, I have a large form with a number of Date Picker controls. So, I actually made a slight change to the code to make it work for all Date Picker controls across the form, and not require any setting changes to the individual controls.

I've replaced this:

NWF$('#' + dateCtrl)

with this:

NWF$('.nf-date-picker')

Thank you once again Marian Hatala‌!


Ok, so how about those of us using responsive forms? I need a date of birth field, and going back only 10 years is a huge problem. 


unfortunatelly, with responsive forms you're out of luck...


Newbie question...do I just copy and paste the above code into Settings > Custom JavaScript ? I've tried and nothing happens.

You need to link the function to your action, unless you use @chaddavis  solution to apply it to every date picker action on your form.



To use the function on a single action as @emha suggested do the following:





  • Open your Date Picker action


  • go to Advanced


  • Change 'Store Client ID in JavaScript variable' to Yes


  • type 'dateCtrl'.




You can type the ID name you like,  but you have to make sure you update the function as well.



NWF.FormFiller.Events.RegisterAfterReady(function(){
   NWF$('#' + dateCtrl).datepicker('option',{
       yearRange: "-50:+50",
   })
})


 



Hopefully this helps


con esta funcion puesta en la zona de javascripr de la configuracion del formulario me funciona perfecto, hice un par de ajustes




NWF$(document).ready(function() {  

NWF$('.nf-date-picker').datepicker('option',{

yearRange: "-50:+50",

})

})

How are you adding JS to a responsive form or is this for classic only???


Reply