cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
cchan000
Level: Powered On

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
Super User
Super User

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

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
Super User
Super User

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

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

cchan000
Level: Powered On

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

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?

Super User
Super User

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

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
firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

Top Kudoed Authors
Users Online
Currently online: 325 members 3,629 guests
Please welcome our newest community members: