Text input validation based on text color

![image|657x236]

I am trying to create a coupon code validation. My input block for the code turns green when the code typed in matches the valid ones in my data type “Coupon” list of valid codes.
It also checks for expiration date.
Then I would like the apply code button to appear based on the color of the input in the input code block. I do not want the Apply Code button to appear when the text input is read (unvalidated.)

How does one specify the color of a text block as a discriminator?
Should I do this some other way?
(upload://tGvHA6ymhpJdoYZMPVmFGqy9Pzq.png)

image

image

I think you can easily do it with conditionals. However, it is applying the conditional either after the input lost the focus or press enter or 1-2 seconds later:
chrome_JKJRbYxcpY

And here is the conditionals:

What is meant by when the value is invalid? Where is the test being done? Can I set any value as INVALID?

I just typed VALID and INVALID as sample texts. It can be anything of course. Technically, you can get the value of the input and compare it your database or check the date etc. I just compared it to a fixed text.