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

Disable button based off empty dropdown value

I have an excel spreadsheet table that feeds my dropdown box values in Powerapps. I left an empty cell so that I can have an empty value as the first selection in my dropdown box.

 

I need to disable the submit button if the empty value is selected. I don't want the user to submit the form if the empty value is selected. I figured out how to disable the button for the "traffic" value but I do not know the name of that empty value to make my formula work. See screen shots.

 

Please help 🙂

 

If((Reasons_DD).Selected.Value = "Traffic",DisplayMode.Disabled,DisplayMode.Edit)

 

Capture_reasons.JPG

 

 

 

 

 

 

 

 

 

 

 

 

Capturedropdown.JPG

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
wyotim
Resident Rockstar
Resident Rockstar

Hey @ersula82, try this:

 

If(IsBlank(Reasons_DD.Selected.Value),DisplayMode.Disabled,DisplayMode.Edit)

View solution in original post

wyotim
Resident Rockstar
Resident Rockstar

@ersula82 Try this: 

 

If(
Or(
IsBlank(Reasons_DD.Selected.Value),
And(
IsBlank(Other_Txtbox.Text),
Other_Txtbox.Visible
)
),
DisplayMode.Disabled,
DisplayMode.Edit
)

This is assuming that the Other_Txtbox is only visible when it is able to be used, and thus if it is visible it should not be blank either. Let me know if that works out for you.

View solution in original post

14 REPLIES 14
wyotim
Resident Rockstar
Resident Rockstar

Hey @ersula82, try this:

 

If(IsBlank(Reasons_DD.Selected.Value),DisplayMode.Disabled,DisplayMode.Edit)

View solution in original post

That worked! I tried that earlier but I think I put my parenthesis in the wrong place. Awesome!

wyotim
Resident Rockstar
Resident Rockstar

Glad to hear it worked for you!

@wyotim a quick question, in that same dropdown box I have an "other" option which when selected displays a textbox for the user to type in.

I need to disable the submit button both if the textbox is blank OR if the dropdown value is blank. 

 

Right now both of the below formulas work on their own but I've tried to figure out how to combine them and it's not accepting anything I type.

 

Disable the button if the text box is blank:

If(IsBlank(Other_Txtbox),DisplayMode.Disabled,DisplayMode.Edit)

 

Disable the button if the dropdown value is blank:

If(IsBlank(Reasons_DD),DisplayMode.Disabled,DisplayMode.Edit)

 

Help!

Capturedropdown.JPG

 

CaptureOtherBox.JPG

 

 

 

 

 

wyotim
Resident Rockstar
Resident Rockstar

@ersula82 Try this: 

 

If(
Or(
IsBlank(Reasons_DD.Selected.Value),
And(
IsBlank(Other_Txtbox.Text),
Other_Txtbox.Visible
)
),
DisplayMode.Disabled,
DisplayMode.Edit
)

This is assuming that the Other_Txtbox is only visible when it is able to be used, and thus if it is visible it should not be blank either. Let me know if that works out for you.

View solution in original post

@wyotim this worked although I'm a little confused on the nesting statement but I guess I'll continue to learn as I go along. I was literally up for hours attempting every if statement variation I can think of so thank you for your speedy reply. You saved me time!

 

Ersula

wyotim
Resident Rockstar
Resident Rockstar

@ersula82 Glad it worked out! I will post an explanation of the nested statement, hopefully tonight but definitely by tomorrow.

 

In my mind, it’s only a solution if it is repeatable and understood so I am happy to get into the details and make it as clear as I can.

wyotim
Resident Rockstar
Resident Rockstar

Okay, here we go on this explanation. This may be something you already know, so forgive me if this is too basic but I thought I would get into the And() and Or() functions. Without going too in depth or getting to basic, these functions compare two or more Boolean (true or false) statements and return a true or false based on the result.

 

For And(), if all the compared statements are true, it returns true; otherwise, it returns false.

 

For Or() if just one of the compared statements is true, it returns true; otherwise, it returns false.

 

I can go more in-depth on these if you like, but that is the general idea.

 

For the specific code, I will start with the And() section. The two statements it compares are:

 

1) if the Other_Txt text is blank and

2) if the Other_Txt label is visible.

 

To return true, both of these statements must be true (i.e. the text is blank and the label is visible). Otherwise (i.e. if the text is not blank or the label is not visible), it will return false. Since the visibility of the Other_Txt input area is tied to the selection of "Other" in the Reasons_DD drop down, it is that selection that will trigger this statement. If it never becomes visible (i.e. "Other" is not selected), it will return false. 

 

For the Or() section, we use:

 

1) if the Reasons_DD drop down has nothing selected and

2) the result of the previous And() section.

 

For this to return true, just one of those needs to be true (i.e. Reasons_DD dropdown has nothing selected or both the Other_Txt text is empty and the Other_Txt label is visible). Otherwise, it will return false.

 

Now, the result of the Or() statement is what then sets the true or false section of the If() statement. If it is true (meaning that the necessary areas are not selected/filled out), the item is disabled. Otherwise, it will be enabled.

 

I am typing this on very little sleep so I hope it makes sense. Feel free to comment back if I need to better word things or if it was total gibberish.  

 

@wyotim that explanation was perfect and helped alot. So, with that understanding, I was able to add a 3rd condition on the Or Statement that I needed to add. I would not have been able to do so without your teaching so thank you! 

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

secondImage

Power Apps Community Call

Please join us on Wednesday, October 20th, at 8a PDT. Come and learn from our amazing speakers!

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
Users online (2,117)