Skip to content

End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

instance method

CGI::HtmlExtension#textarea

textarea(name = "", cols = 70, rows = 10) { || ... }

Generate a TextArea element, as a String.

name is the name of the textarea. cols is the number of columns and rows is the number of rows in the display.

Alternatively, the attributes can be specified as a hash.

The body is provided by the passed-in no-argument block

Example
textarea("name")
   # = textarea("NAME" => "name", "COLS" => 70, "ROWS" => 10)

textarea("name", 40, 5)
   # = textarea("NAME" => "name", "COLS" => 40, "ROWS" => 5)
See also #submit #text_field #scrolling_list also in 3.4 · 3.3 · 3.2 · 3.0