View Full Version : Controlling text boxes
Zapcat
09-24-2002, 10:53 AM
Does anyone know how to present values in a text box, but prevent the user from changing those values. I must be able to change the values using jscript.
Any ideas?
ZapCat:)
chrismiceli
09-24-2002, 01:43 PM
you could make it where they focus on it (click or tab to it) it will direct them somewhere else like this
<form name="form1">
<input type="text" name="test" value="hi onfocus="document.form1.test0.focus()">
<input type="button" name="test0" value="should be focused">
there
Bosko
09-24-2002, 03:12 PM
Eh,why not just use the disabled attribute?:
<input type="button" value="blah" disabled="disabled">
adios
09-24-2002, 04:49 PM
<input type="text" readonly="readonly" onfocus="if(!this.readOnly)this.blur()">
The latter bit is for older browsers. Disabling grays out the control and effectively removes it from the form.
Khaled
04-05-2006, 03:35 PM
Hi all
You can also use
<INPUT TYPE="text" NAME="test" VALUE="Test" READONLY>
I tried it on only IE6 and it works fine.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.