cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
cchan000
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
yashag2255
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
RezaDorrani
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?

yashag2255
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
User Groups Public Preview

Join us for our User Group Public Preview!

Power Apps User Groups are coming! Make sure you’re among the first to know when user groups go live for public preview.

Power Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (28,839)