September 11, 200619 yr 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?
September 11, 200619 yr 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. 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:
Create an account or sign in to comment