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
)
)
Solved! Go to Solution.
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
))
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
))
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
)
)
)
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
User | Count |
---|---|
182 | |
46 | |
46 | |
34 | |
33 |
User | Count |
---|---|
260 | |
87 | |
79 | |
68 | |
67 |