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 : fOsNJOI4IGrl4MziiUpCbf
Power Apps - Building Power Apps
Unanswered

Conditional border color using If( statement

Like (0) ShareShare
ReportReport
Posted on 27 Mar 2024 16:54:56 by 6

I have a large form with many dropdowns and combo boxes. I have successfully set each (except for a couple) to have a red border if they're blank and a black border if they contain a selection.  

 

The ones I'm having issues with are HourValue and MinuteValue dropdown fields. For all other fields I have been able to use the below code to achieve my goal: 

If(
    IsBlank(DCV122.Selected) ,
    Color.Red,
    Color.Black  
)
 
However, when I use the following for my HourValue and MinuteValue dropdown fields, the conditional border color does not work. I don't get an error message, the border just remains black.
If(
    IsBlank(HourValue1.Selected),   //Note: I have also tried .Selected.Value
    Color.Red,
    Color.Black  
)

I believe the issue is because the field is not truly blank even when no selection has been made. It appears that Date and Time fields from SharePoint lists just create dropdowns that have hard coded choices in the "Items" property--for example, the "Items" property of the HourValue dropdown is  ["00","01","02","03"], etc.

So, my question--how can I achieve my desired outcome (red border by default, but black border once a selection has been made) with something other than an If( statement? Or is there a different If( statement I can use? Thank you!
I have the same question (0)
  • daheld Profile Picture
    6 on 27 Mar 2024 at 17:01:54
    Re: Conditional border color using If( statement

    Thanks for this. I'm an idiot. It was that simple. Of course.

  • AldenKnibbs Profile Picture
    107 on 27 Mar 2024 at 16:58:22
    Re: Conditional border color using If( statement

    Have you tested the following?

    If(
        DCVTimeOrMinute.Selected = 0 ,
        Color.Red,
        Color.Black  
    )

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Telen Wang – Community Spotlight

We are honored to recognize Telen Wang as our August 2025 Community…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 637 Most Valuable Professional

#2
stampcoin Profile Picture

stampcoin 570 Super User 2025 Season 2

#3
Power Apps 1919 Profile Picture

Power Apps 1919 473

Loading started