Skip to main content
Nintex Community Menu Bar

How to limit date picker range?

  • Oct 6, 2017 12:30 PM UTC
  • 5 replies
  • 253 views
  • Translate All

Forum|alt.badge.img+2

Hello all!

I was curious if there is a way to limit the date/time control to only allow dates to be selected for past 7 days and current day, no further forward or back?

Thanks! 

5 replies

Forum|alt.badge.img+7
  • Nintex Partner
  • Oct 6, 2017 12:46 PM UTC

Not on selection, but you can define a validation rule that prevent the form to be submitted if date is not in your range.

Translate

Forum|alt.badge.img+2

Found a javascript solution!

NWF$('#' + datebook).datepicker('option',{minDate: '-7d',maxDate: Current Date});

Thanks for the help! 

Translate

Forum|alt.badge.img+6
  • Oct 6, 2017 1:39 PM UTC

Thanks for the solution.

But this is a part of jQuery UI DatePicker , am i right ? To make use of your code one must have or refer the jQuery UI js file.

Translate

Forum|alt.badge.img+3
  • Nov 3, 2017 11:06 AM UTC

I was able to accomplish like this:

Set date picker min val to today:

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

NWF$.datepicker.setDefaults({minDate: new Date()});

});

this sets all datepickers. If I want to set just a single date picker to set the min date to be the date of another datepicker selection it doesn't work:

NWF$("#"+ minDval).on('change',function(){
var minD=NWF$("#"+ minDval).val();
var retD=NWF$("#"+rDval);

retDval.datepicker.setDefaults({minDate: new Date(minD)});
});

any ideas?

Translate

Forum|alt.badge.img
  • Nintex Partner
  • Jun 25, 2019 2:06 PM UTC

Hi @bcobra ,

 

Sorry my english isn't very well but I solved your question.

 

I did it to put min date to specific date picker in nintex forms.

NWF$('#' + varFechaDonacion).datepicker('option',{
minDate: new Date(),
});

 

Where "varFechaDonacion" is variable javascript

Translate