cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Eben98
Advocate II
Advocate II

Calendar Validation for next 3 months.

Hi all, 

I have a date picker in which I should allow the user to only enter dates before the next 3 months.

this month is October. I want them to only enter dates till January end. How can this be done?

If they enter dates after January they shouldn't be able to summit. 

 

Thanks in Advance.

 

Best Wishes,

Eben.

1 ACCEPTED SOLUTION

Accepted Solutions
gabibalaban
Dual Super User
Dual Super User

Hi @Eben98,

1. The OnChange property of the date picker control will help to achieve your goal , use there the Reset(DatePicker1) function into a If clause. Something like this:

 

    If(DatePicker1.SelectedDate>DateAdd(Today(),3,Months), Reset(DatePicker1))

 

Also, for usability, you can:

    -  put an error label to explain to users why the datepicker control was reseted. And Set the visible property of this label to be true when the selected date does not meet your condition. 

   - set the Display Mode property of the submit button to Disabled when  the selected date does not meet your condition.

 

2. Set the Default property of date picker control to Today().

View solution in original post

1 REPLY 1
gabibalaban
Dual Super User
Dual Super User

Hi @Eben98,

1. The OnChange property of the date picker control will help to achieve your goal , use there the Reset(DatePicker1) function into a If clause. Something like this:

 

    If(DatePicker1.SelectedDate>DateAdd(Today(),3,Months), Reset(DatePicker1))

 

Also, for usability, you can:

    -  put an error label to explain to users why the datepicker control was reseted. And Set the visible property of this label to be true when the selected date does not meet your condition. 

   - set the Display Mode property of the submit button to Disabled when  the selected date does not meet your condition.

 

2. Set the Default property of date picker control to Today().

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Top Kudoed Authors
Users online (1,512)