Our Man in Bananas
Our Man in Bananas

Reputation: 5981

How to Check value of combo-box (selected items) in the formula for a button (Visible property)

We have a PowerApps form with several fields that must be completed before the form can be submitted to the Sharepoint List.

We can't make them required or mandatory on the Content-Type and List because we want the users to be able tosave their data, and come back to it to edit it before Submitting...

So we need to disable/hide the Submit button until these fields are completed by the user.

In our Submit Button control we are using a formula to control the Visibility property of the button, or it's container which is the footer.

So we have tried this kind of thing:

If(
    And(
        TitleField.Text <> "",DescOfInitiativeField.Text <> "", DateRaisedField.SelectedDate <> Date(
            1900,
            01,
            01
        ),
        Not IsEmpty(PersonalDataChoiceField.SelectedItems.Value),
        Not IsEmpty(SpecialCatChoiceField.SelectedItems.Value),
        Not IsEmpty(ChildrensDataChoiceField.SelectedItems.Value),
        Not IsEmpty(CriminalChoiceDataField),
    Not IsEmpty(SourcesOfDataChoiceField.SelectedItems.Value),

but we are not having any luck..

So what's the correct way to go about this? How can we test that at least one of the options in each of our combo-box fields is selected?

Upvotes: 4

Views: 2740

Answers (1)

aozk
aozk

Reputation: 418

I don't know why you add .Value after .Selecteditems

If(IsEmpty(ComboBox.SelectedItems),false,true)

It returns false when nothing is selected

Try something like this in your Visible function of your button:

If(IsBlank(TitleField.Text) Or IsBlank(DescOfInitiativeField.Text) 
    Or DateRaisedField.SelectedDate = Date(1900,01,01) 
    Or IsEmpty(PersonalDataChoiceField.SelectedItems) 
    Or IsEmpty(SpecialCatChoiceField.SelectedItems) 
    Or IsEmpty(ChildrensDataChoiceField.SelectedItems) 
    Or IsBlank(CriminalChoiceDataField) 
    Or IsEmpty(SourcesOfDataChoiceField.SelectedItems), false, true)

Upvotes: 4

Related Questions