Skip to main content

Is there a way to dynamically change the background color of an Edit field?   the default is a lovely gold color, but we would like to vary this color for some fields as a way of highlighting the contents.

have a render snippet and have applied changes to the field.element.css background color but this is being overriden by .nx-field and dont seem to be able to change this.

thanks

There two answers are helpful:

https://community.skuid.com/t/changing-the-color-of-text-from-field-in-edit-mode-via-css

https://community.skuid.com/t/change-field-color

By combining Glenn’s solution and taking Rob and Ben’s advice on css specificity I think you are probably just missing making your css a little more specific. For an edit field you need to add the input selector as the Skuid CSS background-color is applied at that level. The following render snippet and CSS works for me on an edit field:


var field = argumentsg0], value = skuid.utils.decodeHTML(argumentsg1]);&nbsp;<br>skuid.ui.fieldRenderersnfield.metadata.displaytype]afield.mode](field, value);&nbsp;<br>if (field.mode == 'edit' &amp;&amp; value == 'ValueForRed') {&nbsp;<br>&nbsp; &nbsp; field.element.addClass("RedBackground");<br>}<br><br>.RedBackground input {<br>&nbsp; &nbsp; background-color: #F99;<br>}

Awesome, works perfectly!!  thanks for your help!


Reply