Changing background color on a label assigned a variable
How can I change the background color of a label when the data from a variable is added?
On page 1: I have a variable that is assigned using a text input field.
On page 2: I have a label that I have linked the variable to (using set value). This adds the variable text 'deadline' to page 2 when it is entered on page 1 on page 2 being loaded. Or not if it isn't.
My problem is that I want the label background on page 2 to change when the variable text is inputted on page 1. And not to change if no text is added on page 1.
The set value (for the variable) on page 2 occurs 'on page load'. If I add a 'change style' interaction here it adds the color change regardless of whether or not there is any data from 'deadline' variable in the label, because the page has loaded. That makes sense, but I only want it to change when there is data in the label, not every time.
I've tried setting the following conditions:
when label has deadline
regex (label, deadline)
when label = deadline
Then adding a Change Style interaction
The trouble with all of these is that the label already is assigned deadline, so they dont work. So then I tried:
when label has text
then adding a Change Style interaction
This doesn't work. Either the 'On page load' overides it, or the 'deadline' variable isn't recognized as text.
I've also tried the above using a show/hide interaction. Hide the label initially, then show the label when the above conditions were met. That didn't work either.
My final effort was to change the label to a text input field, which would allow me to use an 'On Change' event in addition to the 'On Page Load' event. That didn't work either.
As you can probably guess from the above, I know a little bit about formulas, but not enough to actually really know what I am doing, so forgive me if any of the above seems particularly stupid and please be kind.
It seems a simple thing to do, and I am sure there is a simple answer ... suggestions anyone?