cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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

 

14 REPLIES 14
Highlighted

Awesome! I am happy to be able to help and very happy for your success!
Highlighted

Hi Wyotim,

 

I have a similar problem to the original post, I've followed you're instructions but I cant seem to get mine to work!

I have a radio button with "Pass" or "Fail". 
If "Fail" gets selected, it brings up a Comments Box, a dropdown list & a "send email notification" button as shown below.
The If statement I have used for these boxes to appear is if fail is selected is..
If("fail" in Radio5_33.Selected.Value, true) ...which works fine.

PAP3.pngHowever in the 'Assigned To dropdown', I have an option of "N/A".
If N/A is selected, I want the 'Send Email Notification' button to either be hidden or be disabled so it is unable to be pressed. Do you know what formula I need to use to get this to work please?

Thanks.

Highlighted

@JD2301Assuming your dropdown is named 'Assigned To dropdown' and that you want the button to be disabled when "N/A" is selected, you would use the following code in the DisplayMode property of your button:

 

// Disable button if "N/A" is selected
If(
    'Assigned To dropdown'.Selected.Value = "N/A", 
    DisplayMode.Disabled, 
    DisplayMode.Edit
)


I noticed that your dropdown was blank in the picture, so if you want to incorporate that into the mix, the following should work (again in the DisplayMode property of your button):

 

// Disable button if dropdown is blank or "N/A" is selected
If( Or(IsBlank('Assigned To dropdown'.Selected.Value), 'Assigned To dropdown'.Selected.Value = "N/A"), DisplayMode.Disabled, DisplayMode.Edit )

If you instead want to make the button invisible, you would replace DisplayMode.Disabled with false and DisplayMode.Edit with true and put the formula in the Visible property of the button. You could also mix and match a bit, like if you want the button invisible when a blank value is in the dropdown but disabled when "N/A" is selected, but I digress. 

 

Let me know if that works for you. Otherwise, let me know and I'll be happy to help out until it does!

 

*edit for comment in second code snippet*

Highlighted

Hi Wyotim,

 

That is perfect thank you. 
I've set the button to be disabled if "Not Applicable" is selcted and I have changed the blank column to state "Please Select from List" and also managed to make the button disabled if this is chosen using the formula:
If(Dropdown6.Selected.Value = "Not Applicable", DisplayMode.Disabled, If(Dropdown6.Selected.Value = "Please Select From List", DisplayMode.Disabled))

Thanks for your help.

Highlighted

@JD2301Awesome work! A couple suggestions about your code: it may be easier to read and change later if you use an Or statement instead of nesting If statements, especially because they have the same result. Something like:

 

// Disable button if "Not Applicable" or "Please Select From List" is selected
If(
    Or(Dropdown6.Selected.Value = "Not Applicable", Dropdown6.Selected.Value = "Please Select From List"), 
    DisplayMode.Disabled,
    DisplayMode.Edit
)

Also, you may test that your code works when selecting values other than "Not Applicable" and "Please Select From List" due to not explicitly having DisplayMode.Edit in there. It may not work properly. You may need to have something like (my addition to your code in bold):

 

If(
Dropdown6.Selected.Value = "Not Applicable",
DisplayMode.Disabled,
If(
Dropdown6.Selected.Value = "Please Select From List",
DisplayMode.Disabled,
DisplayMode.Edit
)
)

That stuff aside, I am happy you were able to get it working! 

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (7,486)