cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
neill_long
Level: Powered On

Button disabled if fields are empty and dropdown = certain value

I am creating a form which the data will get saved to a collection and i would like to disable the button until all the fields are filled in. 

 

Here is what i have on the buttons displaymode:

If(Site_Drop.Selected.Value = "Please select" && Start_Drop.Selected.Value = "Please select" && End_Drop.Selected.Value = "Please select" && Recurring_Drop.Selected.Value = "Please select" && IsBlank(Dept_Text.Text) && IsBlank(Number_Text.Text) ,Disabled, Edit)

If all the fields are empty then the button is disabled.  But as soon as text is entered into 1 of the fields, the button is enabled regardless of the fact the other fields still need data.

 

 

The form consists of 4 dropdowns and 2 textinput fields.  All the dropdowns have "Please select" as the first option,  so if this is what is displayed then the button should be disabled.

 

Can anyone advise where i have gone wrong in my If statement please?

 

thanks in advance.

Alistair

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Button disabled if fields are empty and dropdown = certain value

@neill_long,

Your statement reduces to disabled if all criteria are met.  What that means is that if one of the criteria is false, then the entire statement is false and the button is enabled.  What you need is for the button to be disabled unless all criteria are true.  By replacing the && with || , I believe that the statement reduces to true if any of the conditions are true, then the button will be disabled. 

If(Site_Drop.Selected.Value = "Please select" || Start_Drop.Selected.Value = "Please select"|| End_Drop.Selected.Value = "Please select" || Recurring_Drop.Selected.Value = "Please select" || IsBlank(Dept_Text.Text) || IsBlank(Number_Text.Text) ,Disabled, Edit)

 

2 REPLIES 2
Super User
Super User

Re: Button disabled if fields are empty and dropdown = certain value

@neill_long,

Your statement reduces to disabled if all criteria are met.  What that means is that if one of the criteria is false, then the entire statement is false and the button is enabled.  What you need is for the button to be disabled unless all criteria are true.  By replacing the && with || , I believe that the statement reduces to true if any of the conditions are true, then the button will be disabled. 

If(Site_Drop.Selected.Value = "Please select" || Start_Drop.Selected.Value = "Please select"|| End_Drop.Selected.Value = "Please select" || Recurring_Drop.Selected.Value = "Please select" || IsBlank(Dept_Text.Text) || IsBlank(Number_Text.Text) ,Disabled, Edit)

 

Highlighted
neill_long
Level: Powered On

Re: Button disabled if fields are empty and dropdown = certain value

@Drrickryp

thank you, works perfectly now.

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

SecondImage

PowerApps Monthly Community Call

Next Wednesday, September 18th at 8am PDT

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Top Kudoed Authors
Users Online
Currently online: 51 members 4,340 guests
Please welcome our newest community members: