diff --git a/Specialized Areas/Browser Bookmarklets/Highlight Mandatory fields on form/Highlight mandatory fields on form.js b/Specialized Areas/Browser Bookmarklets/Highlight Mandatory fields on form/Highlight mandatory fields on form.js new file mode 100644 index 0000000000..5d6c622412 --- /dev/null +++ b/Specialized Areas/Browser Bookmarklets/Highlight Mandatory fields on form/Highlight mandatory fields on form.js @@ -0,0 +1 @@ +javascript:(function(){try{let f=window;if(window.frames.length&&window.frames['gsft_main'])f=window.frames['gsft_main'];if(!f||typeof f.g_form==='undefined'){console.log('No ServiceNow form detected.');return;}const g=f.g_form,d=f.document,sid='sn-mandatory-highlight-style',es=d.getElementById(sid);if(es){es.remove();d.querySelectorAll('.mandatory-glow').forEach(e=>e.classList.remove('mandatory-glow'));return;}const st=d.createElement('style');st.id=sid;st.innerHTML='.mandatory-glow{outline:3px solid #FFD700!important;box-shadow:0 0 10px 3px rgba(255,215,0,0.9)!important;border-radius:6px;transition:all 0.2s ease-in-out;}';d.head.appendChild(st);g.getEditableFields().forEach(n=>{if(g.isMandatory(n)){const e=g.getElement(n);if(!e)return;let c=e.closest('.form-group,.question,.input-group,.field');if(!c)c=e.parentElement;c.classList.add('mandatory-glow');}});}catch(e){console.error('Error:',e);}})(); diff --git a/Specialized Areas/Browser Bookmarklets/Highlight Mandatory fields on form/README.md b/Specialized Areas/Browser Bookmarklets/Highlight Mandatory fields on form/README.md new file mode 100644 index 0000000000..6efb02ebe4 --- /dev/null +++ b/Specialized Areas/Browser Bookmarklets/Highlight Mandatory fields on form/README.md @@ -0,0 +1,24 @@ +## Highlight Mandatory Fields + +**Description** +- This bookmarklet visually highlights all mandatory fields on a ServiceNow form by adding a glowing border or background around them. +- It helps developers, admins, or QA testers quickly see which fields are marked as mandatory. +- It also helps partial visually paired people to find the mandatory fields instead of looking for small * icon for field. +- This works as a toggle. One click highlights the mandatory fields and clicking again removes the highlight. + +**Example :** + +- When activated on a form (e.g. Incident, Request Item): +- Mandatory fields like Short description, Caller, etc get a soft glowing yellow border. +- Click again → glow is removed. + +**How it works:** +- Detects `g_form` context. +- Adds a temporary CSS class (`.mandatory-glow`) to all mandatory fields. +- Click again to remove the highlights. + +**Sample screenshot** +image + + +