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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Disable Submit button ...
Power Apps
Answered

Disable Submit button for Current Date

(0) ShareShare
ReportReport
Posted on by 188

Hi All, I want to disable my button if user selected current date.  Except for Emergency leave type and Sick leave . Can you help me with this?

 

Here's my code for my submit button in displaymode properties

 

 

 

 

With(
 {
 wLeave: Leavetype.Selected.Value,
 wLeaveAmt: Value(TextInput2_9.Text),
 wSLQualified: ContacVar.'Sick Qualified'.Value,
 wPLQualified: ContacVar.'Paternity Qualified'.Value,
 wMLQualified: ContacVar.'Maternity Qualified'.Value,
 wSPQualified: ContacVar.'SP Qualified'.Value,
 wBLQualified: ContacVar.'Bereavement Qualified'.Value,
 wVAWCQualified: ContacVar.'VAWC Qualified'.Value,
 wVLQualified: ContacVar.'Vacation Qualified'.Value,
 wSPWQualified: ContacVar.'SPW Qualified'.Value,
 wELQualified: ContacVar.'Vacation Qualified'.Value,
 DaysToStart: DateDiff(
 Today(),
 StartDates.SelectedDate,
 Days
 ),
 TotalDays: DateDiff(
 StartDates.SelectedDate,
 EndDates.SelectedDate,
 Days
 )
 },
 If(
 !'SLDCC Leave Form'.Valid || wLeave = "Vacation Leave" && (wVLQualified = "No" || wLeaveAmt > Value(TextInput1_9.Text)) || wLeave = "Emergency Leave" && (wELQualified = "No" || wLeaveAmt > Value(TextInput1_9.Text)) || wLeave = "Sick Leave" && (wSLQualified = "No" || wLeaveAmt > Value(TextInput1_9.Text)) || wLeave = "Paternity leave" && (wPLQualified = "No") || wLeave = "Maternity leave" && (wMLQualified = "No" || wLeaveAmt > Value(TextInput1_21.Text)) || wLeave = "Bereavement Leave" && (wBLQualified = "No" || wLeaveAmt > Value(TextInput1_24.Text)) || wLeave = "Leave for Victim of Violence (Women&Children)" && (wVAWCQualified = "No" || wLeaveAmt > Value(TextInput1_27.Text)) || wLeave = "Parental Leave for Solo Parent" && (wSPQualified = "No" || wLeaveAmt > Value(TextInput1_18.Text)) || wLeave = "Special Leave for Women" && (wSPWQualified = "No" || wLeaveAmt > Value(TextInput1_30.Text)) || (EndDates.SelectedDate < StartDates.SelectedDate) || If(
 Leavetype.Selected.Value = "Emergency Leave" || TotalDays < 2 || DaysToStart >= 5,
 DisplayMode.Edit,
 DisplayMode.Disabled
 ),
 DisplayMode.Disabled,
 DisplayMode.Edit
 )
)

 

 

 

 

disable.PNG

 

@StalinPonnusamy 

Categories:
  • Verified answer
    StalinPonnusamy Profile Picture
    Super User 2024 Season 1 on at

    Hi @pword 

     

    Please try this

     

    With(
     {
     wLeave: Leavetype.Selected.Value,
     wLeaveAmt: Value(TextInput2_9.Text),
     wSLQualified: ContacVar.'Sick Qualified'.Value,
     wPLQualified: ContacVar.'Paternity Qualified'.Value,
     wMLQualified: ContacVar.'Maternity Qualified'.Value,
     wSPQualified: ContacVar.'SP Qualified'.Value,
     wBLQualified: ContacVar.'Bereavement Qualified'.Value,
     wVAWCQualified: ContacVar.'VAWC Qualified'.Value,
     wVLQualified: ContacVar.'Vacation Qualified'.Value,
     wSPWQualified: ContacVar.'SPW Qualified'.Value,
     wELQualified: ContacVar.'Vacation Qualified'.Value,
     DaysToStart: DateDiff(
     Today(),
     StartDates.SelectedDate,
     Days
     ),
     TotalDays: DateDiff(
     StartDates.SelectedDate,
     EndDates.SelectedDate,
     Days
     )
     },
     If(
     !'SLDCC Leave Form'.Valid || wLeave = "Vacation Leave" && (wVLQualified = "No" || wLeaveAmt > Value(TextInput1_9.Text)) || wLeave = "Emergency Leave" && (wELQualified = "No" || wLeaveAmt > Value(TextInput1_9.Text)) || wLeave = "Sick Leave" && (wSLQualified = "No" || wLeaveAmt > Value(TextInput1_9.Text)) || wLeave = "Paternity leave" && (wPLQualified = "No") || wLeave = "Maternity leave" && (wMLQualified = "No" || wLeaveAmt > Value(TextInput1_21.Text)) || wLeave = "Bereavement Leave" && (wBLQualified = "No" || wLeaveAmt > Value(TextInput1_24.Text)) || wLeave = "Leave for Victim of Violence (Women&Children)" && (wVAWCQualified = "No" || wLeaveAmt > Value(TextInput1_27.Text)) || wLeave = "Parental Leave for Solo Parent" && (wSPQualified = "No" || wLeaveAmt > Value(TextInput1_18.Text)) || wLeave = "Special Leave for Women" && (wSPWQualified = "No" || wLeaveAmt > Value(TextInput1_30.Text)) || (EndDates.SelectedDate < StartDates.SelectedDate), 
    DisplayMode.Disabled, If(
     wLeave = "Emergency Leave" || wLeave = "Sick Leave" || (DaysToStart > 0 && (TotalDays < 3 || DaysToStart >= 5)),
     DisplayMode.Edit,
     DisplayMode.Disabled
     ))

     

  • pword Profile Picture
    188 on at

    Thank you @StalinPonnusamy  its working .😀 but I put some code to apply it to my unpaid leave but didn't work. The submit should be disable because of the unpaid  selected date

     

    Heres my code:

     

     

    With(
     {
     wLeave: Leavetype.Selected.Value,
     wLeaveAmt: Value(TextInput2_9.Text),
     wSLQualified: ContacVar.'Sick Qualified'.Value,
     wPLQualified: ContacVar.'Paternity Qualified'.Value,
     wMLQualified: ContacVar.'Maternity Qualified'.Value,
     wSPQualified: ContacVar.'SP Qualified'.Value,
     wBLQualified: ContacVar.'Bereavement Qualified'.Value,
     wVAWCQualified: ContacVar.'VAWC Qualified'.Value,
     wVLQualified: ContacVar.'Vacation Qualified'.Value,
     wSPWQualified: ContacVar.'SPW Qualified'.Value,
     wELQualified: ContacVar.'Vacation Qualified'.Value,
     DaysToStart: DateDiff(
     Today(),
     StartDates.SelectedDate,
     Days
     ),
     TotalDays: DateDiff(
     StartDates.SelectedDate,
     EndDates.SelectedDate,
     Days
     ),
     DaysToStartUnpaid: DateDiff(
     Today(),
     StartDateUnpaid.SelectedDate,
     Days
     ),
     TotalUnpaidDays: DateDiff(
     StartDateUnpaid.SelectedDate,
     EndDateUnpaid.SelectedDate,
     Days
     )
     },
     If(
     !'SLDCC Leave Form'.Valid || wLeave = "Vacation Leave" && (wVLQualified = "No" || wLeaveAmt > Value(TextInput1_9.Text)) || wLeave = "Emergency Leave" && (wELQualified = "No" || wLeaveAmt > Value(TextInput1_9.Text)) || wLeave = "Sick Leave" && (wSLQualified = "No" || wLeaveAmt > Value(TextInput1_9.Text)) || wLeave = "Paternity leave" && (wPLQualified = "No") || wLeave = "Maternity leave" && (wMLQualified = "No" || wLeaveAmt > Value(TextInput1_21.Text)) || wLeave = "Bereavement Leave" && (wBLQualified = "No" || wLeaveAmt > Value(TextInput1_24.Text)) || wLeave = "Leave for Victim of Violence (Women&Children)" && (wVAWCQualified = "No" || wLeaveAmt > Value(TextInput1_27.Text)) || wLeave = "Parental Leave for Solo Parent" && (wSPQualified = "No" || wLeaveAmt > Value(TextInput1_18.Text)) || wLeave = "Special Leave for Women" && (wSPWQualified = "No" || wLeaveAmt > Value(TextInput1_30.Text)) || (EndDates.SelectedDate < StartDates.SelectedDate),
     DisplayMode.Disabled,
     If(
     wLeave = "Emergency Leave" || wLeave = "Sick Leave" || (DaysToStart > 0 && (TotalDays < 3 || DaysToStart >= 5)) || (DaysToStartUnpaid > 0 && (TotalUnpaidDays < 3 || DaysToStartUnpaid >= 5)),
     DisplayMode.Edit,
     DisplayMode.Disabled
     )
     
     )
    )

     

     

     

    unpaid.PNG

     

    @StalinPonnusamy 

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 221 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 188 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 120

Last 30 days Overall leaderboard