cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helper V
Helper V

Sharepoint PowerApps Form - two date picker boxes. how to make sure 2nd box is always later date than first.

hi. hopefully a simple question.

 

i have two date fields. one is start date, one is end date. obviously i don't want the end date ever to be earlier than the start date. can i make it an error if this is chosen? how?

1 ACCEPTED SOLUTION

Accepted Solutions
Dual Super User II
Dual Super User II

Hi @cchan000 

 

There is no need to make any formula changes to DatePickers. To display an error, you can create a text label, and set the below configurations: 
Label Control
Text -> "Start Date cannot be greater than End Date"
Color -> Red
VIsible -> If(DatePicker1.SelectedDate > DatePicker2.SelectedDate, true,false)
 
Here, DatePicker1 corresponds to Start Date and DatePicker2 corresponds to End Date.
 
Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

3 REPLIES 3
Dual Super User II
Dual Super User II

Hi @cchan000 

 

Disable the submit button by setting displaymode property for button as

If(dateEnd.SelectedDate<dateStart.SelectedDate,DisplayMode.Disabled,DisplayMode.Edit)

 

Also add a label with erro message text

and set visible property of label to 

dateEnd.SelectedDate<dateStart.SelectedDate

 

where dateStart and dateEnd are control names of date field

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

hi. this is what i put in the SECOND date picker right? The first one i leave alone?

 

this is what i have right now in the DATA CARD properties of the second picker.

 

If(FIRSTDATACARD.SelectedDate<FIRSTDATACARD.SelectedDate,DisplayMode.Disabled,DisplayMode.Edit)

 

FIRSTDATACARD = the datacard of the first date picker. is what i have above right?

Dual Super User II
Dual Super User II

Hi @cchan000 

 

There is no need to make any formula changes to DatePickers. To display an error, you can create a text label, and set the below configurations: 
Label Control
Text -> "Start Date cannot be greater than End Date"
Color -> Red
VIsible -> If(DatePicker1.SelectedDate > DatePicker2.SelectedDate, true,false)
 
Here, DatePicker1 corresponds to Start Date and DatePicker2 corresponds to End Date.
 
Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

Helpful resources

Announcements
News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

Power Apps Community Call

Power Apps Community Call- January

Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

Top Solution Authors
Top Kudoed Authors
Users online (4,534)