Skip to main content
Nintex Community Menu Bar
Solved

Year Range issue with Date Picker Control on Nintex Form

  • Mar 14, 2018 2:35 PM UTC
  • 10 replies
  • 357 views
  • Translate All

Forum|alt.badge.img+1

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

Best answer by emha

you can configure it, but only with a javascript

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

10 replies

Forum|alt.badge.img+14
  • Scholar
  • Answer
  • Mar 15, 2018 7:44 AM UTC

you can configure it, but only with a javascript

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

Forum|alt.badge.img+1
  • Author
  • Mar 15, 2018 12:04 PM UTC

Thanks so much.  It worked for me.

Translate

Forum|alt.badge.img+14
  • Scholar
  • Mar 15, 2018 5:56 PM UTC

Great!

Please mark the question answered.

Translate

Forum|alt.badge.img+7
  • May 7, 2018 2:18 PM UTC

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‌!

Translate

Forum|alt.badge.img+3

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. 

Translate

Forum|alt.badge.img+14
  • Scholar
  • Aug 27, 2018 8:15 PM UTC

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

Translate

Forum|alt.badge.img+4
  • Rookie
  • Oct 3, 2019 12:50 PM UTC
Newbie question...do I just copy and paste the above code into Settings > Custom JavaScript ? I've tried and nothing happens.
Translate

Forum|alt.badge.img+1
  • Rookie
  • Nov 20, 2019 11:48 PM UTC

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

Translate

JohanEsteban92
Nintex Partner

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",
   })
})
Translate

  • Novice
  • Jan 20, 2022 7:45 PM UTC

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

Translate