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
Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

thirdimage

Power Apps Community User Group Member Badge

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

sixthImage

Join THE global Microsoft Power Platform event series

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Microsoft Business Applications Virtual Launch

Join us for the Microsoft Business Applications Virtual Launch Event on Thursday, April 2, 2020, at 8:00 AM PST.

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (10,670)