cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Eric_at_CSG
Level: Powered On

Change Text Input Control border color based on if it is blank or not

Hello, I am working with TextInput controls and Buttons.

 

I want to create a button that if the input is blank, they the border color will change to red, otherwise it will change to green.

 

The function I have for the Button OnSelect is:

 

If(IsBlank(TextInput1), TextInput1.BorderColor=Red, TextInput1.BorderColor=Green)

 

When I set Button1 to this, the border color of the TextInput1 control does not change.

 

My goal is to set required TextInput fields, that if left blank, will cause the border color to change so the user can identify them a little easier.

 

Any help would be greatly appreciated.

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Change Text Input Control border color based on if it is blank or not

You can't directly set property value from another another property or action. The properties are declarative, so what you need to do is use a variable in the property and then use the button to change the value of the variable.

 

Example:

Screen > OnVisible = Set(gvBorderColor, Black)

TextInput1 > BorderColor = gvBorderColor

Button > OnSlect = If(IsBlank(TextInput1), Set(gvBorderColor, Red), Set(gvBorderColor, Green))



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

View solution in original post

3 REPLIES 3
Super User
Super User

Re: Change Text Input Control border color based on if it is blank or not

You can't directly set property value from another another property or action. The properties are declarative, so what you need to do is use a variable in the property and then use the button to change the value of the variable.

 

Example:

Screen > OnVisible = Set(gvBorderColor, Black)

TextInput1 > BorderColor = gvBorderColor

Button > OnSlect = If(IsBlank(TextInput1), Set(gvBorderColor, Red), Set(gvBorderColor, Green))



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

View solution in original post

Eric_at_CSG
Level: Powered On

Re: Change Text Input Control border color based on if it is blank or not

Thank you so much! I never thought about global variables for this problem. Worked like a charm. 

FernandoG
Level: Powered On

Re: Change Text Input Control border color based on if it is blank or not

Is it possibe to increase or decrease the color RGBA value ever time the button is clicked?

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (5,247)