Discussions
Categories
Groups
Advertisement
Child Item
Home
Topics
Technology & Internet
Software & Web Development
Development
Uneditable input field in Javascript
Draupnir
Anyone know how to make an input field in Javascript which cannot be edited by the user?
Find more posts tagged with
Quick Links
All Categories
Recent Posts
Activity
Unanswered
Groups
Best Of
Advertisement
Advertisement
Comments
Zaltais
Disabled or Readonly?
[PHP]
Disabled:
<INPUT disabled name="fred" value="stone">
[/PHP]
[PHP]
Readonly:
<INPUT readonly name="fred" value="stone">
[/PHP]
You can change this in Javascript with:
document.formName.fred.disabled = "False"
document.formName.fred.readonly = "False"
This funcionality is not consistient across all browsers though so test before you implement
Draupnir
Cheers, worked a treat.
Yerac
Just be careful with it if you are using for cgi scripts or similar. It can be over-ridden , expecially if not compatible in all browsers.
If you are submitting the value to a script of some sort, make sure to validate at server end too.