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.