cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
pword
Helper III
Helper III

Disbabled Submit Button

I want to Disable my Submit button if all required fields have no input. Can you help me ? Heres my code on Displaymode button

 

 

If(
Leavetype.Selected.Value = "Paternity leave",
If(
Value(TextInput2_9.Text) > Value(TextInput1_12.Text),
DisplayMode.Disabled,
('SLDCC Leave Form'.Valid),
Edit,
DisplayMode.Disabled
)
) & If(
Leavetype.Selected.Value = "Bereavement Leave",
If(
Value(TextInput2_9.Text) > Value(TextInput1_24.Text),
DisplayMode.Disabled,
('SLDCC Leave Form'.Valid),
Edit,
DisplayMode.Disabled
)
) & If(
Leavetype.Selected.Value = "Maternity leave",
If(
Value(TextInput2_9.Text) > Value(TextInput1_21.Text),
DisplayMode.Disabled,
('SLDCC Leave Form'.Valid),
Edit,
DisplayMode.Disabled
)
) & If(
Leavetype.Selected.Value = "Leave for Victim of Violence (Women&Children)",
If(
Value(TextInput2_9.Text) > Value(TextInput1_27.Text),
DisplayMode.Disabled,
('SLDCC Leave Form'.Valid),
Edit,
DisplayMode.Disabled
)
) & If(
Leavetype.Selected.Value = "Parental Leave for Solo Parents",
If(
Value(TextInput2_9.Text) > Value(TextInput1_18.Text),
DisplayMode.Disabled,
('SLDCC Leave Form'.Valid),
Edit,
DisplayMode.Disabled
)
) & If(
Leavetype.Selected.Value = "Sick Leave",
If(
Value(TextInput2_9.Text) > Value(TextInput1_9.Text),
DisplayMode.Disabled,
('SLDCC Leave Form'.Valid),
Edit,
DisplayMode.Disabled
)
) & If(
Leavetype.Selected.Value = "Vacation Leave",
If(
Value(TextInput2_9.Text) > Value(TextInput1_9.Text),
DisplayMode.Disabled,
('SLDCC Leave Form'.Valid),
Edit,
DisplayMode.Disabled
)
)

2 ACCEPTED SOLUTIONS

Accepted Solutions
WarrenBelz
Super User
Super User

Hi @pword ,

Note the below is free-typed, so watch commas, brackets etc, but you should get the idea.

With(
   {
      wLeave:Leavetype.Selected.Value,
      wLeaveAmt:Value(TextInput2_9.Text)
   },
   If(
      !'SLDCC Leave Form'.Valid ||
      (
         wLeave = "Paternity leave" && 
         wLeaveAmt > Value(TextInput1_12.Text)
      ) ||
      (
         wLeave = "Bereavement Leave" && 
         wLeaveAmt > Value(TextInput1_24.Text)
      ) ||
      (
         wLeave = "Maternity leave" && 
         wLeaveAmt > Value(TextInput1_21.Text)
      ) ||
      (
         wLeave = "Leave for Victim of Violence (Women&Children)" && 
         wLeaveAmt > Value(TextInput1_27.Text)
      ) ||
      (
         wLeave = "Parental Leave for Solo Parents" && 
         wLeaveAmt > Value(TextInput1_18.Text)
      ) ||
      (
         wLeave = "Sick Leave" || wLeave = "Vacation Leave" && 
         wLeaveAmt > Value(TextInput1_9.Text)
      ),
      DisplayMode.Disabled,
      DisplayMode.Edit
   )
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

Hi @pword ,

You have an and/or mix that needs bracketing - when you state

wLeave = "Maternity leave" &&
wMLQualified = "Not Qualified" ||
wLeaveAmt > Value(TextInput1_21.Text

do you mean

wLeave = "Maternity leave" &&
(wMLQualified = "Not Qualified" || wLeaveAmt > Value(TextInput1_21.Text)

or

(wLeave = "Maternity leave" && wMLQualified = "Not Qualified") || 
wLeaveAmt > Value(TextInput1_21.Text

 

View solution in original post

24 REPLIES 24
WarrenBelz
Super User
Super User

Hi @pword ,

Note the below is free-typed, so watch commas, brackets etc, but you should get the idea.

With(
   {
      wLeave:Leavetype.Selected.Value,
      wLeaveAmt:Value(TextInput2_9.Text)
   },
   If(
      !'SLDCC Leave Form'.Valid ||
      (
         wLeave = "Paternity leave" && 
         wLeaveAmt > Value(TextInput1_12.Text)
      ) ||
      (
         wLeave = "Bereavement Leave" && 
         wLeaveAmt > Value(TextInput1_24.Text)
      ) ||
      (
         wLeave = "Maternity leave" && 
         wLeaveAmt > Value(TextInput1_21.Text)
      ) ||
      (
         wLeave = "Leave for Victim of Violence (Women&Children)" && 
         wLeaveAmt > Value(TextInput1_27.Text)
      ) ||
      (
         wLeave = "Parental Leave for Solo Parents" && 
         wLeaveAmt > Value(TextInput1_18.Text)
      ) ||
      (
         wLeave = "Sick Leave" || wLeave = "Vacation Leave" && 
         wLeaveAmt > Value(TextInput1_9.Text)
      ),
      DisplayMode.Disabled,
      DisplayMode.Edit
   )
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

Hi @WarrenBelz  How to disbable my submit button if my checkbox was uncheck. I use your code but my submit button was enable  while my check box was uncheck. Thank you

Attached my screenshot

checkbox.PNGcheckbox1.PNG

@pword ,

You just need add the checkbox condition

If(
   !'SLDCC Leave Form'.Valid ||
   !YourCheckboxName.Value ||
   ( . . . .       

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

@WarrenBelz  I try your code but my submit was disable while my checkbox was checked. Thank you

 

code.PNGscreenshot2.PNG

@pword ,

Then there is something else wrong with your filter as !Checkbox1_1.Value means it is testing for it to be unchecked (if it is checked, this test will fail). Did the rest of the code work without this in?

Yes @WarrenBelz , the rest of the code is working. But i want my checkbox to be required, even if checked or unchecked my checkbox,  my sumbit button was disbable when i put the checkbox condition.

@pword ,

There is a bug there somewhere, however try this (the long way)

With(
   {
      wLeave:Leavetype.Selected.Value,
      wLeaveAmt:Value(TextInput2_9.Text),
      wNoCheck:CheckBox1_1.Value <> true
   },
   If(
      !'SLDCC Leave Form'.Valid || wNoCheck ||
      (
         wLeave = "Paternity leave" && 
         wLeaveAmt > Value(TextInput1_12.Text)
      ) ||
      (
         wLeave = "Bereavement Leave" && 
         wLeaveAmt > Value(TextInput1_24.Text)
      ) ||
      (
         wLeave = "Maternity leave" && 
         wLeaveAmt > Value(TextInput1_21.Text)
      ) ||
      (
         wLeave = "Leave for Victim of Violence (Women&Children)" && 
         wLeaveAmt > Value(TextInput1_27.Text)
      ) ||
      (
         wLeave = "Parental Leave for Solo Parents" && 
         wLeaveAmt > Value(TextInput1_18.Text)
      ) ||
      (
         wLeave = "Sick Leave" || wLeave = "Vacation Leave" && 
         wLeaveAmt > Value(TextInput1_9.Text)
      ),
      DisplayMode.Disabled,
      DisplayMode.Edit
   )
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Thank you but It's still the same @WarrenBelz . See screenshot below maybe it can help

 

check.PNGdaata.PNGgal.PNG

 

 

@pword ,

Put a label on the screen with Checkbox1_1.Value and check/uncheck it to see what is shown. Also why do you have those values on the OnCheck and OnUncheck - they do not make a lot of sense to me presently. Also what type of field is it writing to?

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (2,326)