class Forma::TextField
Text field.
Attributes
password[R]
Public Class Methods
new(h = {})
click to toggle source
Calls superclass method
Forma::SimpleField::new
# File lib/forma/field.rb, line 299 def initialize(h = {}) h = h.symbolize_keys @password = h[:password] super(h) end
Public Instance Methods
edit_element(val)
click to toggle source
# File lib/forma/field.rb, line 309 def edit_element(val) el('input', attrs: { id: self.id, name: parameter_name, type: (password ? 'password' : 'text'), value: val.to_s, autofocus: @autofocus, style: { width: ("#{width}px" if width.present?) } }) end
view_element(val)
click to toggle source
# File lib/forma/field.rb, line 305 def view_element(val) el((@tag || 'span'), text: (password ? '******' : val.to_s), attrs: { id: self.id }) end