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 / !IsBlank() and !IsEmpt...
Power Apps
Unanswered

!IsBlank() and !IsEmpty() for combo box

(2) ShareShare
ReportReport
Posted on by 4

Hello, guys. I just don't know what to do anymore, so PLEASE, give me a hand or two, if possible...

 

I have a job to do to my boss. I creater a powerapps screen that saves data in a Sharepoint List, but one field of this screen, a combo box, receives data from the List to charge the choices available. 

 

So here we are:

 

tela 1.PNG

 

If I let any of the marked fields (*) blank and press "Save", it is supposed to appear an error screen:

tela 2.PNG

 

So If I fill the blank fields, everything's ok!

 

tela 3.PNG

 

BUUUUUT if I unmark, de-select the combobox previously selected item...

 

tela 4.PNG

 

It keeps saving the data of this page on my Sharepoint List, and without one of the mandatory values... Did you understand?

 

This is what I put on Save button:

 

If(
!IsBlank(Titulo_Novo.Text) && <- this is the first mandatory item
(!IsEmpty(Unidade_Departamento_Regiao_Novo.Selected.Value) Or <- this line...
!IsBlank(Unidade_Departamento_Regiao_Novo.Selected.Value) <- and this line were supposed to be working, checking if the field (combo box), which is the second mandatory item, is not empty or is not blank!
)
&&
!IsBlank(Objeto_Novo.Text) <- this one is the third mandatory item.
;
Set(Borda_TituloNovo; Black);;Set(Borda_UnidadeNovo; Black);;Set(Borda_ObjetoNovo; Black);;Set(Borda_ValorNovo;Black);; <- here I'm turning all the three mandatory items borders black.

UpdateContext({Popup_Salva_Item:true}) && UpdateContext({Fundo_CinzaNovo:true}); <- here I'm showing an pop up information message and a gray screen behind it.

UpdateContext({Popup_Alerta_Campos:true}) && UpdateContext({Fundo_CinzaNovo:true}) <- here I'm showing an pop up warning message and a gray screen behind it.
)

 

The warning message should pop up on the screen if any of the three mandatory itens were blank. 

 

Why the heck is that rule on the save button working for the combo box only if I select and item and de-select it? How should it be the correct way to write this rule?...

 

Categories:
I have the same question (0)
  • AndySid Profile Picture
    165 on at

    If I understand you correctly, if there is no values in the ComboBox, or the values are removed from the ComboBox then show a message.

     

    In this example I disable the save button but the method is the same.

    The combobox Items are Units.Unit

     

    Rule: IsEmpty(ComboBox1.SelectedItems.Unit)

     DisplayMode for Submit (generated by the rule)

    If(Rule2, DisplayMode.Disabled
    , DisplayMode.Edit
    )

     

    Does this help, if so please mark as a solution (:

     

     

     

  • Verified answer
    Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    Hi @leomosqueira,

    FYI a Combobox contains a Table, even if it contains a single item or one column, so the appropriate function to test it would be IsEmpty() rather then IsBlank().  However, you can use IsBlank to test whether there is text in the Combobox's search property. 

    IsBlank(ComboBox1.SearchText)

    wil give a true/false result that can be used to change the Items property of a gallery or data table. I use this to remove the filter from a gallery using an UpdateContext() variable. 

    If(IsBlank(Combobox2.SearchText),UpdateContext({itms: mydatasource}),
    UpdateContext({itms:Filter(mydatasource,ID=Combobox.Selected.ID)})

    and then set the Items property of a gallery to itms. That way if text is not typed into the Combobox, all the items in the gallery are shown or else the gallery is filtered on the Combobox.

  • Community Power Platform Member Profile Picture
    on at

    Hi all,

     

    I have kind of a similar problem.

    I have a button that is grayed out when there is no value in a combobox that is dependent of a dropdown list.

     

    DisplayMode on the Button:

    If(IsBlank(Choose_PH_Name);DisplayMode.Disabled)

    Everything works fine, EXCEPT when I click the "X" in that combo which ends up displaying no value and the button is NOT grayed out, allowing to click and navigate.

    Esle, if I change the dropdown item, than the combobox clears if there was any value in it, and the button is disabled (has blank() Default value). As I want it to.

     

    Tried lot's of solutions to no avail.

    Any help appreciated.

     

    Thank you,

    PSAR

  • Krishna09 Profile Picture
    234 on at

    I had similar kind of issue but I couldn't solve it. 

    I replaced Como box type for a text card, on submit button selected, I want it to show error message when not selected. During form filling and submitting error message is working fine. But when I redrive data and view it and if i submit with out changing these particular columns which i have changed datatype, only they show  error message. Can you please explain why this is happening?

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @Krishna09 

    This sounds like a new problem. Post it as the answer will be lost here. 

  • Community Power Platform Member Profile Picture
    on at

    Use

    IsBlank(Name_of_Box.Selected.Value)

     

    and do something if it's blank... or....

    !IsBlank(Name_of_Box.Selected.Value)

     

    and have it do whatever if it's not blank...

  • IswaryaPari Profile Picture
    7 on at

    It works me

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 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard