Sha256: f6b170686cd253271196d13a823db3a6ece1ca591c346f225d9d9f6651df04b9

Contents?: true

Size: 668 Bytes

Versions: 1

Compression:

Stored size: 668 Bytes

Contents

$:.unshift File.expand_path("../../lib", __FILE__)
require "form"

params = {
  :name => "John Doe",
  :email => "john@example.org",
  :bio => "Code-addicted.\nThat's all you need to know about me."
}

# The first argument indicates the datasource.
# In this case, we're using a simple hash.
# The second argument indicates the root name
# that will compose the input's name.
form = Form.new(params, :user)

# Just output an input[type=text].
puts form.text(:name)

# Same fashion, just output an input[type=email]
puts form.email(:email)

# More inputs.
puts form.textarea(:bio)
puts form.submit(:create)

# Output the label for name attribute.
puts form.label(:name)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
form-0.0.1.alpha1 examples/hash.rb