-
Notifications
You must be signed in to change notification settings - Fork 14
How to create a text area using the text area function
Added for version: 0.4
So you want to allow your user to enter in text with multiple lines? Use the text-area function.
The text-area function should be used only inside forms. Otherwise, you may not be able to capture the user input.
Text-area takes a record, the name of the record, the key in record to get the value from, and optional html-options.
To create a text area for a :message record with value “Blah” associated with key :text use:
(text-area { :text "Blah" } :message :text)
The above link passes the map { :text “Blah” } as the record to use. More likely, the record you use comes from your database or other model.
The name text-area tag is “message[text]”, the id of the tag is “message-text”, and the value of the tag is “Blah”.
You can pass html-options to add attributes to the input tag. To set the text area to read only use:
(text-area { :text "Blah" } :message :text { :readonly "readonly" })