text_field

text_field(name = "", value = nil, size = 40, maxlength = nil)
Instance Public methods

Generate a text field Input element, as a String.

name is the name of the input field. value is its initial value. size is the size of the input area. maxlength is the maximum length of input accepted.

Alternatively, the attributes can be specified as a hash.

text_field("name")
  # <INPUT TYPE="text" NAME="name" SIZE="40">

text_field("name", "value")
  # <INPUT TYPE="text" NAME="name" VALUE="value" SIZE="40">

text_field("name", "value", 80)
  # <INPUT TYPE="text" NAME="name" VALUE="value" SIZE="80">

text_field("name", "value", 80, 200)
  # <INPUT TYPE="text" NAME="name" VALUE="value" SIZE="80" MAXLENGTH="200">

text_field("NAME" => "name", "VALUE" => "value")
  # <INPUT TYPE="text" NAME="name" VALUE="value">
doc_ruby_on_rails
2015-03-31 22:30:50
Comments
Leave a Comment

Please login to continue.