0

Color field to change the text color and the backround for the formula field.

Hello 

I want to use the color field to change the text color and the backround for the formula field.

for exemple, there is a Formula field, and next to it a Color field. When changing the value of the Color field, the font style in the Formula field beckground should change.

Has anyone tried to do this before? Is it possible?

6 replies

null
    • szormpas
    • 4 mths ago
    • Reported - view

     Hi,

    I do not know how to alter directly the style of the formula field based on color field value but you can have similar results via html():

    html("<p style='color:" + Color + "'>Text</p>")
    
      • iliper LTD
      • iliper_LTD
      • 4 mths ago
      • Reported - view

       Thanks for the help, the formula works but, how to make it so that the formula field values are taken from the number field and then there is the ability to change the text color and background?

      • Rafael Sanchis
      • Rafael_Sanchis
      • 4 mths ago
      • Reported - view
      • szormpas
      • 4 mths ago
      • Reported - view

        Hi, 

      If you want the formula field to display the value of a number field then use this:

      html("<p style='color:" + Color + "'>" + Number + "</p>")
      

      In the code above replace the 'Number' with the name of your number field.

      It is possible to change in addition the background color but you have to use one more color field in your form. Then the html() could be like:

      html("<strong style='color:" + 'Text color' + "; background:" + 'Background color' +
      "'>" +
      Number +
      "</strong>")
      
    • red_kite
    • 4 mths ago
    • Reported - view

    You can use this, with two colorfields an one numberfield.

    
    styled(text(numberfield), colorfield1, colorfield2, "")
    
      • iliper LTD
      • iliper_LTD
      • 4 mths ago
      • Reported - view

       thanks, it works well and I got the result I needed

Content aside

  • Status Answered
  • 4 mths agoLast active
  • 6Replies
  • 54Views
  • 4 Following