How do I change the color of a text box if there is no data in it?

  • 0
  • 1
  • Question
  • Updated 4 years ago
  • Answered

I am a total noob here. I have seen answers here about using formulas, but I don't know where to enter the formula.  I want a text box to have a yellow background if it is blank (null).  

Photo of Joseph


  • 0 Points

Posted 4 years ago

  • 0
  • 1
Photo of Scott


  • 334 Points 250 badge 2x thumb
Unfortunately, changing the color of an actual cell isn't possible in native quickbase.  You may be able to do this with dandiebolt's image onload technique, however it is most certainly not noob friendly.

Solution which may work for you...
Users cannot directly enter data into a formula field so at a minimum you will need two fields.  
Field 1: Text - "textbox"
Field 2: Formula - Text - "formula"

On your form, (where you would view/enter data), you will need to add both these fields.  You will need to set their properties so that the textbox will show when you are editing only and the formula will show when you are viewing only.  Here's a screenshot of what I mean...

Now that you have the form set up, lets work on that formula.  

Edit the formula and enter the following code:
If([Textbox]="","<img src=\"PUT YOUR IMAGE LINK HERE\" alt=\"Null\" />",[Textbox])

Replace PUT YOUR IMAGE LINK HERE with any of these icons  We are using this as an alternative to changing the cells color.  Hopefully it will work for you, I regularly use these in my apps.

Ensure that the "allow html to be used" is checked in the properties of your formula field (right above where the code goes!) and click save!

You should be all set!  Hopefully this works for you, I know it isn't exactly the same as changing the cells color, but adding an image is a useful alternative!