SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Oct 2001
    Location
    Nottingham,England
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Dynamically change the "Readonly" attribute

    Hi,

    I'd like to synamically change the readonly attribute of a text box using Javascript. I've tried

    document.theForm.theObject.readonly=false;

    and

    document.getElementById('theObject').readonly = false;

    but niether seem to work, can anyone help !!
    Cheerz
    Austin Rathe
    Developer
    www.Breeze-It.com

  2. #2
    SitePoint Addict
    Join Date
    May 2000
    Posts
    313
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Have you tried:
    document.theForm.theObject.disabled=true to not allow someone to edit a text field and
    document.theForm.theObject.disabled=false to enable them to.

  3. #3
    SitePoint Member
    Join Date
    Oct 2001
    Location
    Nottingham,England
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by requestcode
    Have you tried:
    document.theForm.theObject.disabled=true to not allow someone to edit a text field and
    document.theForm.theObject.disabled=false to enable them to.
    Yea, but the disabled atribute means that anything submitted can't be "sucessful", ie isn't passed onto the processing agent, also, i want user's to be able to copy from the box.

    Thanks anyway.
    Cheerz
    Austin Rathe
    Developer
    www.Breeze-It.com

  4. #4
    ALT.NET - because we need it silver trophybronze trophy dhtmlgod's Avatar
    Join Date
    Jul 2001
    Location
    Scotland
    Posts
    4,836
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Don't know if this will work, haven't tried it

    Code:
    document.theForm.theObject.readOnly = true
    document.theForm.theObject.readOnly = false


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •