cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Nintex Newbie

Service Calendar Scheduler - Limit Date Picker based on Choice

Jump to solution

I am trying to create a Service Request Scheduler. I would like to Limit the Date Picker based on Service Drop-Down. 

 

For example; If I only do Oil Changes on Monday. When the user selects Oil Change from the Service type field, I only want Mondays to be selectable in the Date Picker. If a user selects Brake Repair, I only want Tuesday - Thursday selectable. Additionally, I need to limit the hours selectable to between 10am and 4pm, in 1 hour increments. 

Labels: (1)
0 Kudos
Reply
1 Reply
Nintex Newbie

Re: Service Calendar Scheduler - Limit Date Picker based on Choice

Jump to solution

More or less figured it out. Here's the form script based on other work found in the forums.

The first part limits the hours in the time picker and the other functions limit the dates selectable in the date picker.

NWF$("select[name$='Hours'] option").each(function(){
     if(NWF$(this).val().match(/^(([1-9]|12) AM)|(([5-9]|1[0-1]) PM)/g)) {
          NWF$(this).remove();
     }
});
NWF.FormFiller.Events.RegisterAfterReady(function () {  
    NWF$('#' + Service).change(function(evt){
        switch(evt.target.value){
            case 'Oil Change' :
            NWF$('#' + dateCtrl).datepicker('option',{
            beforeShowDay: function(currDate){
                   if(currDate.getDay() == 1 )
                         return [true,""];
                   return [false,""];
     }
     })
                break;
 
         }
    });
    NWF$('#' + Service).change(function(evt){
        switch(evt.target.value){
            case 'Brake Repair' :
            NWF$('#' + dateCtrl).datepicker('option',{
            beforeShowDay: function(currDate){
                   if(currDate.getDay() == 5 )
                         return [true,""];
                   return [false,""];
     }
     })
                break;
 
         }
    });
 
    NWF$('#' + Service).change(function(evt){
        switch(evt.target.value){
            case 'Tire Repair' :
            NWF$('#' + dateCtrl).datepicker('option',{
            beforeShowDay: function(currDate){
                   if(currDate.getDay() == 2 || currDate.getDay() == 3 || currDate.getDay() == 4 )
                         return [true,""];
                   return [false,""];
     }
     })
                break;
 
         }
    });

View solution in original post

0 Kudos
Reply