cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Spawn10
Helper II
Helper II

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

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?

1 ACCEPTED SOLUTION

Accepted Solutions

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

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
Drrickryp
Super User II
Super User II

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
Community Support
Community Support

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

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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?

 

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

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

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),
        {....,.....,.....
	}
     )
   );

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza Winner Announcement

Please join us on Wednesday, July 21st at 8a PDT. We will be announcing the Winners of the Demo Extravaganza!

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (1,972)