SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Wizard DoubleDee's Avatar
    Join Date
    Aug 2010
    Location
    Arizona
    Posts
    3,529
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Formatting Text Area

    I need a form control for a Comments field and am not sure how things work.

    How do I create a Text Area that is a certain width and height where...

    - The text wraps inside the Text Area but no carriage returns are added to the text when it is INSERTED in MySQL.

    - If the text is greater than the size of the Text Area, then a Vertical Scroll Bar will appear

    Thanks,


    Debbie

  2. #2
    om nom nom nom Stomme poes's Avatar
    Join Date
    Aug 2007
    Location
    Netherlands
    Posts
    10,233
    Mentioned
    47 Post(s)
    Tagged
    1 Thread(s)
    You can set the height and width of a textarea two ways:

    1. rows and cols attributes are mandatory
    2. CSS can override. You can set height and width in ems or px or whatever you want.

    The text wraps inside the Text Area
    default : )
    If the text is greater than the size of the Text Area, then a Vertical Scroll Bar will appear
    Also default (some browsers always give textareas scrollbars, which are disabled until the user has added enough text to need it on... this is a bit out of your control but meh. Doesn't really matter.)

    Textareas, unlike text inputs, are multi-line inputs. They are built by nature to accept newline characters.

    but no carriage returns are added to the text when it is INSERTED in MySQL.
    However your backend receiving the data could strip those out before feeding to your database. Whatever backend script you've got now processing, validating and transforming the data would be the one to do that. Not on the client side (not with HTML or Javascript)


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
  •