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
You can set the height and width of a textarea two ways:
- rows and cols attributes are mandatory
- 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)