Jump to content

Styling Disabled Fields

Recommended Posts



Is it possible to style disabled fields on a Web Form?

I've been trying to look at styles and it seems that there is no option to style/format a disabled element field.


A disabled element seems to look the same as an active one. I was hoping I can do some styling to make it stand-out or imply to the users that certain elements on the web form are disabled (commonly due to rules restriction).


Hope someone can help.




Link to comment
Share on other sites

Hello TroubleShooter,


It is possible with a little help from our friend, JavaScript.

Just paste this code snippet to your Footer (HTML Editor should be disabled from the Advanced Tab (as usual))


var frm = document.querySelector(`[action*="[@cbAppKey]" `);

frm.addEventListener('DOMSubtreeModified', function() {

  frm.querySelectorAll('input').forEach( function(elem) {
   if (elem.disabled == true)
   else elem.parentNode.parentNode.parentNode.classList.remove("elem-disabled")



var event = new Event("DOMSubtreeModified");



What this does is, it adds/removes the class of "" to the table row (<tr>) of the disabled element. This enables us to target specific fields related to disabled elements via CSS.


To style your elements, you may use the following CSS Rules to be pasted on your DataPage Header (HTML Editor should be disabled from the Advanced Tab (as usual))

/* .elem-disabled row itself  */
.elem-disabled {
background: green !important;

/* label child elements of .elem-disabled  */
.elem-disabled label {
color: blue !important;
/* td elements of .elem-disabled  */
.elem-disabled td {
color: red !important;
/* All child elements of .elem-disabled  */
.elem-disabled * {
color: yellow !important;



Hope this helps.


Happy Hacking!


Link to comment
Share on other sites

  • 4 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...