web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / End date greater than ...
Power Apps
Unanswered

End date greater than start date

(0) ShareShare
ReportReport
Posted on by

I am working on a date validation, so the user can not save the item in SharePoint if the end date is before the finish date. I have a powerapps form and a sharepoint list. 

 

Any suggestions would be great, thanks

Categories:
I have the same question (0)
  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @Anonymous 

    You might want to consider disabling the "Submit/Save" button if the dates do not validate.

    Set the DisplayMode property of the button to:

       If(endDate < finishDate, Disabled, Edit)

     

    Obviously this formula would need to be modified to meet your actual control names and properties.

     

    I hope that is helpful for you.

  • Community Power Platform Member Profile Picture
    on at

    For me to use that solution, I would have to hide the save/cancel options and create buttons in wich I have no idea. Could you please show me how to do it?

  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @Anonymous 

    This solution does not require any additional buttons.  You are simply changing the DisplayMode property of the Save button that you already have to the formula provided.

     

    So, let's say you have a EndDate DatePicker and a FinishDate DatePicker control on your form.  You can simply change the DisplayMode property of the Save button to this formula:

       If(EndDate.SelectedDate < FinishDate.SelectedDate, Disabled, Edit)

     

    Beyond that, you'll need to share more details on your date controls/datacards/or columns, and your save button details.

  • Community Power Platform Member Profile Picture
    on at

    But I do not have a Save button, I use the option that the Sharepoint form havesave.PNG

  • GrischkePro Profile Picture
    287 on at

    This is what I would do.

     

    Set button's Visibility to true or false like so:

    If(EndDate > StartDate,true,false)
    True = show button
    False = hide button
    If(EndDate is greater than StartDate,show Submit button, don't show Submit button)

    You can also add a label and set its visibility to true if the above is false. For example: If EndDate is less than Start date, show error message (the label).

    edit:

    @Anonymous we are talking about the EditForm, Submit(EditForm) button.

  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @Anonymous 

    Ah, SharePointIntegration!!

     

    So in this case, yes, you cannot alter the save button, but you can alter its behaviour. 

    In the OnSave action of the SharePointIntegration control, you can change the formula to the following:

       If(EndDate.SelectedDate < FinishDate.SelectedDate,

          Notify("Check Dates"),

          SubmitForm(SharePointForm1))

     

    This will check the two dates (again, you need to adjust the names to reflect your form controls) and if they are invalid, then it will Notify the user about the issue (you can do other things if needed).  

    If the dates are good, then it will do the normal SubmitForm function.

     

     

     

  • Community Power Platform Member Profile Picture
    on at

    Sorry but I can't seem to get where to put that code, I do not see the integration control you are talking about. Could you please share a screenshot of where it is

  • Verified answer
    RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @Anonymous 

    It will be in the left side component naviagation tree, listed as SharePointIntegration

    You will click on that and then choose the OnSave property in the property drop down list.  Then alter the formula there.

    Javargas.png

  • Community Power Platform Member Profile Picture
    on at

    It was right there! Thank you very much!

  • Community Power Platform Member Profile Picture
    on at

    One last thing, in SubmitForm(SharePointForm1), the "SharePointFom1" is the name of the SharePoint list?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard