Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
kfahri342
Contributor III
Contributor III

Colour change to text box when clicked on

Hi all,

I have a few text boxes that when clicked on - it will toggle on/off a criteria I have set under Actions.

Is there a way to change the colour of the box, so I have one colour when it is toggled on and another colour for when it is toggled off.

I hope this makes sense. Let me know, otherwise.

Kind Regards

Kozan

1 Solution

Accepted Solutions
Anonymous
Not applicable

See if this meets your need. 

Pressing button switches color back and forth.

Pressing Clear will cause the button to go back to default Blue.

View solution in original post

17 Replies
Anil_Babu_Samineni

May be you need to do this in Photoshop only. Then use those in your application

Please add me Anil_Babu_Samineni to interact faster when reply back. Speak low think High.

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
krishnacbe
Partner - Specialist III
Partner - Specialist III

Assign Variable some value like On = 1 and Off = 2.

Set the Text box color based on the Variable value like Ex. if(vColor=1,Green(), blue())

Anonymous
Not applicable

create a variable that gets updated when the text box is clicked on.

Like:

let vButtonColor=0

Then in your action Set External >> Set Variable

=not $(vButtonColor)

Then in your object background color select calculated and enter a formula something like

=if((vButtonColor),Red(),Blue())

tom2qlik
Creator
Creator

To do this create a variable for when a textbox is clicked.

In your textbox properties select actions and add.  Select "External" from the list on the left and "Set Variable" from the list on the right then hit ok.

In the value box type the formula " =if(VariableName = 0, 1, 0) "

Next click on the general tab.  Look for the button next to "Color" under background.

In the Base color area select "Calculated" and enter in the following formula into the expression box.

if(vChange=1, rgb(0,240,16), rgb(210, 210, 210))

Change the RGB values to your desired colour's.

You can apply this process to each textbox that you have and the background colour of each will change on click.

Hope this helps.

kfahri342
Contributor III
Contributor III
Author

I would expect the colour of the text to go back to the original colour if the User hits the clear button. This doesn't happen.

Anyway around this?

kfahri342
Contributor III
Contributor III
Author

I would expect the colour of the textbox  to go back to the original colour if the User hits the clear button. This doesn't happen.

Anyway around this?

Anonymous
Not applicable

You would need to add an action at the document level to change the variable value.

On the OnAnySelect level.

something like

if(isnull(GetCurrentSelections()),vButtonColor,)

in the variable name field

and the

Value is still          not $(vButton)

passionate
Specialist
Specialist

Hi Kozan,

There are multiple solution to your query.

1. Add action to your text box which have action for clear all

2. PFA solution.

Regards,

Pankaj

kfahri342
Contributor III
Contributor III
Author

Hi, I don't fully understand how to pull this off. Are you able to do some screenshot or provide a document if not too much trouble.

Apologies for my ignorance, but I am new to this.

I have managed to complete what you mentioned in your earlier post so far, but every time I hit Clear the colour still doesn't reset :

"create a variable that gets updated when the text box is clicked on.

Like:

let vButtonColor=0

Then in your action Set External >> Set Variable

=not $(vButtonColor)

Then in your object background color select calculated and enter a formula something like

=if((vButtonColor),Red(),Blue())"