How to make a text box scrollable but not editable? (1 Viewer)

RSW

Registered User.
Local time
Today, 03:55
Joined
May 9, 2006
Messages
178
Hello,

I have the following code, which displays some non-updateable information in a text box.

Code:
document.write("<table> <tr><td class='cellTitleRow' align='center' >PLAN</td></tr>");
   document.write("<tr><td>");
   queryObj.setParam(2,1);
   var worked = cmdApp.executeCommand();
   var currentText;

   if (worked) {
      currentText = cmdApp.getValueByName("DESCR",1);
   }
   else {
      appletExecutionError("Can't retrieve information from Database", document.cmdApp);
   }

   document.write("<TEXTAREA ROWS=4 COLS='72%' disabled=true>"+currentText+"</TEXTAREA>");
   document.write("</td></tr> </table> <br>");

The problem is that the scroll bar is greyed out on the box. If I remove the "disabled=true" statement near the end of the code, I do get a working vertical scroll bar--but then the text within the box can be modified. I don't want that.

Is there some way I can activate the scroll bar, but still leave the text greyed out?

Thanks in advance...
 

RSW

Registered User.
Local time
Today, 03:55
Joined
May 9, 2006
Messages
178
Interestingly enough, the code box above is sort of like what I want to do. Scroll bar is active (although I want a vertical one, not a horizontal), and yet the text can't be edited.

Is there some way to modify my own code to accomplish this?
 

wazz

Super Moderator
Local time
Today, 18:55
Joined
Jun 29, 2004
Messages
1,711
locked=true

edit: forgot you want it greyed-out. you might have to do it with colours. or perhaps you could use a mousedown or mouse click event to keep people out. but i don't think that's what you want to do.
 

RSW

Registered User.
Local time
Today, 03:55
Joined
May 9, 2006
Messages
178
Thanks...

With locked=true, I get the scroll bar, but I can still type in the field.

With locked=true disabled=true, I get the same situation described in the first post.

Is there any way to have the scroll bar but not allow typing?
 

RSW

Registered User.
Local time
Today, 03:55
Joined
May 9, 2006
Messages
178
locked=true

edit: forgot you want it greyed-out. you might have to do it with colours. or perhaps you could use a mousedown or mouse click event to keep people out. but i don't think that's what you want to do.


Oh, I don't care about the color. I just want users to be able to use the scroll bar, but not modify the field contents. It doesn't need to be greyed-out as long as this is accomplished.
 

wazz

Super Moderator
Local time
Today, 18:55
Joined
Jun 29, 2004
Messages
1,711
hi. will readonly still give you the scrollbar? (edit: just tried it and it works: readonly="readonly" ).
 
Last edited:
  • Like
Reactions: RSW

RSW

Registered User.
Local time
Today, 03:55
Joined
May 9, 2006
Messages
178
That didn't quite work, but readonly=true does! Thanks!
 

AngelaP

Registered User.
Local time
Today, 03:55
Joined
May 26, 2009
Messages
10
Yeah readonly is good trick such as :

<input type="text" readonly>
 

AngelaP

Registered User.
Local time
Today, 03:55
Joined
May 26, 2009
Messages
10
<input type="text" readonly>

That's a good trick too!
 

Users who are viewing this thread

Top Bottom