web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Help with IF statement...
Power Apps
Unanswered

Help with IF statement - Display Mode on Button

(0) ShareShare
ReportReport
Posted on by 143

Hi Team,

 

I'm needing help with an IF/IF-AND statement. I want the button to be disabled if two conditions are not met. The conditions are:

1. A dropdown box value is selected

2. A form is valid.

I am able to have the button work just running with the condition: If(Form1.Valid, DisplayMode.Edit,DisplayMode.Disabled)

 

So I am naturally trying this with no success:

If((IsEmpty(DataCardValue39.SelectedItems.Value)) & (Form1.Valid), DisplayMode.Edit, DisplayMode.Disabled)

Categories:
I have the same question (0)
  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at
    Re: Help with IF statement - Display Mode on Button

    @notepadapp

    If(Len(DataCardValue8.Selected. Value)=0 & Form1.Valid, DisplayMode.Edit, DisplayMode.Disabled)

  • SoPatt Profile Picture
    Microsoft Employee on at
    Re: Help with IF statement - Display Mode on Button

    & is the string concatenation operator.
    && is the boolean and operator.

    I suspect you want the latter.

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at
    Re: Help with IF statement - Display Mode on Button

    Yep! 

  • notepadapp Profile Picture
    143 on at
    Re: Help with IF statement - Display Mode on Button

    So Sorry,
    So this: ?
    If(Len(DataCardValue39.Selected.Value) = 0 && Form1.Valid, DisplayMode.Edit, DisplayMode.Disabled)

    The button stays disabled, I believe that it's not detecting the dropdown selection.

  • SoPatt Profile Picture
    Microsoft Employee on at
    Re: Help with IF statement - Display Mode on Button

    Highlight DataCardValue39.Selected in your editor. What does it show?

  • notepadapp Profile Picture
    143 on at
    Re: Help with IF statement - Display Mode on Button

    The selected value. (Data Type: Record). I think it's detecting 0 as a number and not blank?

  • SoPatt Profile Picture
    Microsoft Employee on at
    Re: Help with IF statement - Display Mode on Button

    I would try:
    If(IsBlank(DataCardValue39.Selected) && Form1.Valid,DisplayMode.Edit,DisplayMode.Disabled)
    If(IsEmpty(DataCardValue39.SelectedText.Value) && Form1.Valid,DisplayMode.Edit,DisplayMode.Disabled)

    Also it might be worth trying without "&& For1.Valid" to ensure you're getting the right behavior related to DataCardValue39, i.e. you're not looking in the wrong place.

  • notepadapp Profile Picture
    143 on at
    Re: Help with IF statement - Display Mode on Button

    Sorry still no luck, the alternative is that Form1 has two dropdowns which I am also relying on being entered before the button becomes active.

    Would there be a way to do something like the following?

     

    If((IsEmpty(DataCardValue39.Selected.Value) & (IsEmpty(DataCardValue20.Selected.Value) & (IsEmpty(DataCardValue30.Selected.Value)))),DisplayMode.Edit,DisplayMode.Disabled).

    Until all three dropdowns are selected then be DisplayMode.Edit on the button?

     

  • Verified answer
    Ethan_009 Profile Picture
    4,838 Moderator on at
    Re: Help with IF statement - Display Mode on Button

    Hi @notepadapp ,

     

    I hope your datacard is actually a dropdown control, if yes try the following code:

    If(
     (!IsBlank(DataCardValue39.SelectedItems) && !IsBlank(DataCardValue39.Selected.Value)) && 
     Form1.Valid, 
     DisplayMode.Edit, 
     DisplayMode.Disabled
    )

     

    Hope this helps

  • notepadapp Profile Picture
    143 on at
    Re: Help with IF statement - Display Mode on Button

    Looking promising. Yep, believe they are are 🙂

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

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 322 Super User 2025 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 209 Super User 2025 Season 2

Last 30 days Overall leaderboard