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

Announcements

News and Announcements icon
Community site session details

Community site session details

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

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

    @notepadapp

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

  • SoPatt Profile Picture
    Microsoft Employee on at

    & 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

    Yep! 

  • notepadapp Profile Picture
    143 on at

    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

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

  • notepadapp Profile Picture
    143 on at

    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

    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

    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

    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

    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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 429 Most Valuable Professional

#2
11manish Profile Picture

11manish 191 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 122 Super User 2026 Season 2

Last 30 days Overall leaderboard