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 / How do I change border...
Power Apps
Answered

How do I change bordercolor on a control, if it has no data when a user submits data?

(0) ShareShare
ReportReport
Posted on by 330

I am trying to validate that certain fields contain data before sending the data to my SharePoint list. Right now I am doing something like this...

If(
 !IsBlank(TxtInput_1.Text, Set(BorderColor, Red), Set(BorderColor, Black)) && !IsBlank(DropDwn_1.Selected.Value.Text, Set(BorderColor, Red), Set(BorderColor, Black)) && !IsBlank(radioBtn_1.Selected.Value, Set(BorderColor, Red), Set(BorderColor, Black))
 Patch(
 MyList_1,
 Defaults(MyList_1),
 {
		
		}
	)
)

but this is giving me errors that state that there are some invalid arhuments. What is the best way to go about doing this?

Categories:
I have the same question (0)
  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    Hi @Spawn10 ,

    In the BorderColor property of each control that you wanted to highlight, you would put the following formula

    If(!IsBlank(DataCardValue16.Text),Black, Color.Red)

    Once you submit the form, it won't matter what the border color is.  If you want to prevent the user from submitting the form unless the field has data, then set the Required property of the card containing those particular controls to true.  That will change the border properties, prevent the form from being submitted and show an error message.

  • v-yutliu-msft Profile Picture
    Microsoft Employee on at

    Hi @Spawn10 ,

    Do you want that: if all the fields are not null, the border color is black; if any field are null, the border color is red?

    I suggest you try this formula: ( the border color is not related with patch function.)

    If(
     !IsBlank(TxtInput_1.Text)&&!IsBlank(DropDwn_1.Selected.Value.Text)&& !IsBlank(radioBtn_1.Selected.Value),
    Set(BorderColor, Black),
    Set(BorderColor, Red)
    ); Patch( MyList_1, Defaults(MyList_1), {....,.....,..... } )

     

    Best regards,

    Community Support Team _ Phoebe Liu

  • Spawn10 Profile Picture
    330 on at

    thank you for the help v-yutliu-msft.

    I just have one question...using it this way, won't the patch operation still be executed even if one of the fields is blank?

     
  • Verified answer
    v-yutliu-msft Profile Picture
    Microsoft Employee on at

    Hi @Spawn10 ,

    If you use this formula, whether the field is blank will not effect the patch operation.

    It only effect the border color.

    Regardless the field is blank or not , the patch function will perform.

    Do you want that if any field is blank, the patch operation will not perform?

     

     

    Best regards,

    Community Support Team _ Phoebe Liu

  • Spawn10 Profile Picture
    330 on at

    Yes I didn't want the patch to perform, if those fields were blank. I ended up using this syntax and it served my purpose....

    If(
     IsBlank(TxtInput_1.Text) || IsBlank(DropDwn_1.Selected.Value.Text) || IsBlank(radioBtn_1.Selected.Value),
     Set(BorderColor, Red),
    	 Patch(
     MyList_1,
     Defaults(MyList_1),
     {....,.....,.....
    	}
     )
     );

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

#2
11manish Profile Picture

11manish 136 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 109 Super User 2026 Season 2

Last 30 days Overall leaderboard