Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

HTML "textarea" cannot be grayed out even if "disabled" is specified

bonsai
Mega Sage
<p>test
		<textarea disabled = "ture"  id="test_field" cols="40" rows="8" maxlength="100"></textarea>
	</p>

 

I am trying to implement code like above on a UI page to display an input box.

I want to show a grayed out input box that doesn't accept input, but it doesn't work.

I was able to implement a function that does not accept input, but it cannot be grayed out. .

1 ACCEPTED SOLUTION

@bonsai 

 

I am not sure why it has been not grayed out for you, coz  I have used same code and it has performed both the operations for me, please update the code as mentioned below and try again!

 

 <textarea disabled="true" style="background-color: #EFEFEF" id="test_field" cols="40" rows="8" maxlength="100"></textarea>

 

If my answer solved your issue, please mark my answer as Correct & 👍Helpful based on the Impact. 

View solution in original post

8 REPLIES 8

Prince Arora
Tera Sage

@bonsai .

 

You have implemented correctly, just missed one typo (ture should be true) as mentioned below:

 

<textarea disabled = "true"  id="test_field" cols="40" rows="8" maxlength="100"></textarea>

 

If my answer solved your issue, please mark my answer as Correct & 👍Helpful based on the Impact.

I'm sorry. . .

The code you posted is a typo.

The actual working code is error free, but it doesn't greyed out. .

The above code also does not gray out even if you fix the mistake. .

@bonsai 

 

I have tried in HTML editor and it worked!

PrinceArora_0-1681636797660.png

 

you can try in the UI page(client script) as below:

 

var textArea = document.getElementById("test_field");
textArea.disabled = 'true';

 

If it doesn't work, please share some more details of you UI page(screenshot or script will work)

 

If my answer solved your issue, please mark my answer as Correct & 👍Helpful based on the Impact.

 

 

 

Thank you for answering!

As a trial, could you create a UI page with the following contents?
The input field is deactivated but not grayed out. .

 

 

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<p>test
<textarea disabled = "true" id="test_field" cols="40" rows="8" maxlength="100"></textarea>
</p>

</j:jelly>