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

Notifications

Announcements

Community site session details

Community site session details

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

Disable button based off empty dropdown value

(1) ShareShare
ReportReport
Posted on by 64

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

 

Categories:
I have the same question (0)
  • Verified answer
    wyotim Profile Picture
    2,545 on at

    Hey @ersula82, try this:

     

    If(IsBlank(Reasons_DD.Selected.Value),DisplayMode.Disabled,DisplayMode.Edit)
  • ersula82 Profile Picture
    64 on at

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

  • wyotim Profile Picture
    2,545 on at
    Glad to hear it worked for you!
  • ersula82 Profile Picture
    64 on at

    @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

     

     

     

     

     

  • Verified answer
    wyotim Profile Picture
    2,545 on at

    @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.

  • ersula82 Profile Picture
    64 on at

    @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 Profile Picture
    2,545 on at

    @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 Profile Picture
    2,545 on at

    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.  

     

  • ersula82 Profile Picture
    64 on at

    @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! 

  • wyotim Profile Picture
    2,545 on at
    Awesome! I am happy to be able to help and very happy for your success!

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard