Field Styles for Check boxes

ljschwaberow
Giga Expert

I have reviewed quite a number of Community postings on styling Catalog Variables (http://www.servicenowguru.com/system-ui/field-styles-service-catalog-variables/) and can't seem to find anything on styling check boxes. I am creating an onChange Client Script that sets a number of check box fields to true when a drop down menu option is changed. I would like a way to distinguish (other than the check box and the little green line on the side) that these boxes are default, such as highlighting the label for each check box or the wording in the check box. Has anyone had any success with this?

1 ACCEPTED SOLUTION

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Lindsey Schwaberow



Try


g_form.getControl('checkbox').parentNode.style.color = 'red'


Replace checkbox with the name of the variable(checkbox)



I hope this helps


View solution in original post

4 REPLIES 4

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Lindsey Schwaberow



Try


g_form.getControl('checkbox').parentNode.style.color = 'red'


Replace checkbox with the name of the variable(checkbox)



I hope this helps


Hi pradeepksharma ,



I have a custom application in which there are checboxes.I tried the solution with the onLoad client script but it is not working for me.


For   creating the checkbox I used the true/False variable.


function onLoad() {


    //Type appropriate comment here, and begin script below


g_form.getControl('u_b4_1').parentNode.style.fontWeight = 'bold';



}


Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hello SG,



Applicable for scoped apps: in the standard forms UI (eg client scripts, client ui actions) - by default, we block access to the DOM and certain top-level globals (window, document, $ / jquery). You can enable an application-specific property to gain access to the DOM.


You can enable an application-specific property to gain access to the DOM. This provides a good tradeoff by setting a default with best practice guard rails, and allowing a developer to take explicit action to opt out of the best practice.


To opt out of the best practice create the following property in your scope and set it to false. glide.script.block.client.globals


Hi Pradeep,



My   application is   global scope is it possible to change the property .If yes please let me know form where to change it.



find_real_file.png