Jump to content

[Help-a-noob] marking fields with different colours


Charlie Kilo

This topic is 6470 days old. Please don't post here. Open a new topic instead.

Recommended Posts

So I have a (necessarily) fairly complex form with lots of fields. I would very much like for the user to be able to mark some of those fields in [color:red]red and some in [color:green]green.

I'd like them to be able to do this on the fly. So, regardless of the field's content, the user can mark it red or green.

What's the most elegant way to achieve this?

Link to comment
Share on other sites

Hello frosty666,

There are a number of ways you might approach this, but which one is most elegant is something that depends on how you define elegant. :wink2:

However here is one of the simpler ways to do it:

1. Place a button on your layout and link it to the Set Field[ ] command.

2. Leave the "Specify target field" attribute empty (unassigned)

3. For the calculated result formula enter:

TextColor(Get(ActiveFieldContents); 25660)

4. Name the button "Green" (and/or color it appropriately)

5. Add another similar button with the formula:

TextColor(Get(ActiveFieldContents); 11801640)

6. Name and/or color the second button red.

Now when your users place the cursor into a field and then click one of the buttons, the text in the field will change color.

Of course, you might also want to provide an additional button that changes the color back (eg using the TextColorRemove( ) function.

Or ..if you are feeling a little more adventurous, you might consider setting up the buttons with a slightly more complex formula such as:

Let([

Afc = Get(ActiveFieldContents);

Css = GetAsCSS(Afc)];

If(PatternCount(Css; "#00643C");

TextColorRemove(Afc);

TextColor(Afc; 25660))

)

...which will toggle the color (in this case green) on and off with successive clicks of the button. :mickey:

Link to comment
Share on other sites

This topic is 6470 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.