Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Apr 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    locking textareas

    Hi All,

    I am currently developing a website with a built in CMS where users can log in and view content uploaded by administrators. I have created the HTML table to display the form however, I am echoing data from my database into the textarea allowing users to view this content. I have also incorporated a text editor which allows administrators to change the layout, size, font and colour of documents uploaded to the website.

    I have attempted to use <textarea readonly="readonly"><?php echo $row['words'];?></textarea>

    &

    <textarea disabled="true"><?php echo $row['words'];?></textarea>

    and seem to be having no luck. I would prefer to use the readonly option as the disabled approach enforces a gray style view on the font.

    Any help would be greatly appreciated.

    Thanks,

    Jonneyboy1700
    Last edited by jonneyboy1700; 04-02-2010 at 03:46 PM.

  • #2
    Regular Coder
    Join Date
    Jan 2009
    Posts
    193
    Thanks
    0
    Thanked 20 Times in 20 Posts
    What happens with the readonly attribute? It should make it read only.

    http://www.w3schools.com/TAGS/att_textarea_readonly.asp

  • #3
    New to the CF scene
    Join Date
    Apr 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    When I apply the read only attirbute the textarea remains open to modification. Could the text editor have something to do with this? As when I remove the javascript the read only attirbute will work however it does not display the database contents in the correct formatt.

  • #4
    met
    met is offline
    Regular Coder
    Join Date
    Oct 2009
    Location
    United Kingdom
    Posts
    728
    Thanks
    4
    Thanked 119 Times in 119 Posts
    it would be far less effort to do something like

    PHP Code:
    if user is admin {
     
    // show text box with contents
    } else {
     
    // just show the text in a formatted div, if desired.

    any javascript hack can just be disabled.

  • #5
    New to the CF scene
    Join Date
    Apr 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ok thanks I will give that a try


  •  

    Posting Permissions

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