Click to See Complete Forum and Search --> : uneditable text
Hi peeps
How do you make text uneditable. I have varibles set up in html, but would like to use java script to make sure that the user cant click in the txtbox and change the values
is it something like
document.pageName.variabeName.disable
any help would be very grateful
many thanks
b.
Pittimann
07-23-2004, 10:20 AM
Hi!
document.formName.fieldName.disabled
But that would have the consequence, that such a field's value would not be submitted on form submit. So it is better to use
document.formName.fieldName.readonly
Both of course can be easily tricked by simply disabling javascript; apart from that, some browsers do not "recognize" disabled or readonly. For such cases you could add some stuff to the tag itself:
<input type="text" name="blah" value="don't modify me" onfocus="this.blur()">
Cheers - Pit
steelersfan88
07-23-2004, 10:33 AM
If you do not want it to be changed, why not use CSS to make an element the appearance of a text box.
To have it submitted, simply also include it as a hidden element.
Dr. Script
Pittimann
07-23-2004, 10:55 AM
Hi!If you do not want it to be changed, why not use CSS to make an element the appearance of a text box.Hehe - that's of course much better. :D
Cheers - Pit