Forum Discussion

Shekhar's avatar
Shekhar
Ideator I
6 years ago
Solved

Disabling a field of type Text Area

Hello Experts,

I need to disable a field of type Text Area. I am using the below code on form populate event

var input1 = getFieldByName("Test_Text_Area");
setTimeout(function() {
input1 .getElementsByTagName("input")[0].disabled = true;
}, 100);

When the field is of type Text, the above code works fine but when its of type Text Area , the field is not getting disabled.

Any help is highly appreciated.

Regards,

Shekhar

  • Hi Shekhar,

    getElementsByTagName("input") only works for regular fields.

    Try getElementsByTagName('textarea'). I am not sure if this will work together with getFieldByName. Maybe you can also directly call your textarea:

     var input1 = document.getElementsByTagName('textarea')[0];

    Haven´t tested the samples, but I hope one of them works.

    Ciao,

    Angela

2 Replies

  • Hi Shekhar,

    getElementsByTagName("input") only works for regular fields.

    Try getElementsByTagName('textarea'). I am not sure if this will work together with getFieldByName. Maybe you can also directly call your textarea:

     var input1 = document.getElementsByTagName('textarea')[0];

    Haven´t tested the samples, but I hope one of them works.

    Ciao,

    Angela

    • Shekhar's avatar
      Shekhar
      Ideator I

      Thanks a lot for the quick help Angela. The solution

      input1.getElementsByTagName("textarea")[0].disabled = true; 

      worked.

      Regards,

      Shekhar