Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Uneditable input field in Javascript

  • 06-04-2004 8:55am
    #1
    Registered Users, Registered Users 2 Posts: 3,548 ✭✭✭


    Anyone know how to make an input field in Javascript which cannot be edited by the user?


Comments

  • Closed Accounts Posts: 304 ✭✭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


  • Registered Users, Registered Users 2 Posts: 3,548 ✭✭✭Draupnir


    Cheers, worked a treat.


  • Closed Accounts Posts: 235 ✭✭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.


Advertisement