cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

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
Highlighted
Super User II
Super User II

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
Highlighted
Super User II
Super User II

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

Highlighted

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

Highlighted

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

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (9,909)