Hi Power Apps community,
I am building a vacation app that let people choose their leave and return date. However, there are certain rules such as: an employee have a maximum of 20 days to go on vacation. I have 2 Datepickers, which Datepicker 1 represents the leave date and Datepicker 2 represents the return date. I have also put a label that display how many days are left for an user.
I want to make the displaymode of the submit button disabled if the total days of vacation is more than 20. I have entered my code in the OnChange method of Datepicker2. It doesn't show any error in the code, but the submit button doesn't turn disabled when the total days pass 20. This is my current code:
If(DateDiff(DatePicker1.SelectedDate,DatePicker2.SelectedDate,Days) > Value(txtTotalVacDaysLeft.Text), UpdateContext({PopUp:true}); btnVacSubmit.DisplayMode.Disabled, UpdateContext({PopUp:false}); btnVacSubmit.DisplayMode.Edit)
It would rely help me a lot solving this problem.