Mandatory fields have different colored asterisks.

David Yearsley
Tera Expert

On one of my forms I have a several mandatory fields. Generally a mandatory field has a red asterisk. One of the fields if auto populate with data from another form. When this happens it now show with a black asterisk.

What is causing this asterisk to change colors?

Through programming can you force the asterisk to be red?

Thanks

1 ACCEPTED SOLUTION

coryseering
ServiceNow Employee
ServiceNow Employee

Hi David,



Pre-filled mandatory fields use a different color for the asterisk icon than non-pre-filled mandatory fields. You can actually find this in the heisenberg style sheet:



.is-prefilled .required-marker:before {


      color: #bdc0c4;


}


.required-marker:before {


      font-family: "retina_icons";


      display: inline-block;


      vertical-align: middle;


      line-height: 1;


      font-weight: normal;


      font-style: normal;


      speak: none;


      text-decoration: inherit;


      text-transform: none;


      text-rendering: optimizeLegibility;


      -webkit-font-smoothing: antialiased;


      -moz-osx-font-smoothing: grayscale;


      content: "";


      color: #d64541;


      padding: 0 8px;


}



#bdc0c4 is the default value for $color-light in the default theme (at least on the build I am using), while #d64541 is the default value for $color-red.



You can change the default values for the colors using the built-in theme support:



CSS Theme Support - ServiceNow Wiki



The specific variable is shown here:


CSS Theme Support - ServiceNow Wiki



However, doing so may affect more than you expect. If you want to change *just* the icon, then you may want to look into solutions like:


How to make the mandatory asterisk red on tabs that have mandatory fields


How to make the mandatory asterisk size bigger on tabs that have mandatory fields


Can you left align labels on forms in Eureka? CSS?


Where to find css_includes.css



None of those address your specific question, but they all provide approaches you might take in doing so. Combined with the specific style information provided earlier, you should be able to either change the themes for your instance, or inject CSS on the specific form in question (or all forms, depending on the solution you choose) which overrides that specific class.


View solution in original post

2 REPLIES 2

TJW2
Mega Guru

The colors are setup in the CSS Properties.   In Left NAV type CSS. The properties are as follows.


CSS Properties.PNG


coryseering
ServiceNow Employee
ServiceNow Employee

Hi David,



Pre-filled mandatory fields use a different color for the asterisk icon than non-pre-filled mandatory fields. You can actually find this in the heisenberg style sheet:



.is-prefilled .required-marker:before {


      color: #bdc0c4;


}


.required-marker:before {


      font-family: "retina_icons";


      display: inline-block;


      vertical-align: middle;


      line-height: 1;


      font-weight: normal;


      font-style: normal;


      speak: none;


      text-decoration: inherit;


      text-transform: none;


      text-rendering: optimizeLegibility;


      -webkit-font-smoothing: antialiased;


      -moz-osx-font-smoothing: grayscale;


      content: "";


      color: #d64541;


      padding: 0 8px;


}



#bdc0c4 is the default value for $color-light in the default theme (at least on the build I am using), while #d64541 is the default value for $color-red.



You can change the default values for the colors using the built-in theme support:



CSS Theme Support - ServiceNow Wiki



The specific variable is shown here:


CSS Theme Support - ServiceNow Wiki



However, doing so may affect more than you expect. If you want to change *just* the icon, then you may want to look into solutions like:


How to make the mandatory asterisk red on tabs that have mandatory fields


How to make the mandatory asterisk size bigger on tabs that have mandatory fields


Can you left align labels on forms in Eureka? CSS?


Where to find css_includes.css



None of those address your specific question, but they all provide approaches you might take in doing so. Combined with the specific style information provided earlier, you should be able to either change the themes for your instance, or inject CSS on the specific form in question (or all forms, depending on the solution you choose) which overrides that specific class.