Class: HtmlCom::Form
Instance Method Summary collapse
- #add_submit ⇒ Object
-
#initialize(inputs = nil, id: nil, method: :get, action: '') ⇒ Form
constructor
A new instance of Form.
Methods inherited from Element
#build, #html_element, #to_doc, #to_html
Constructor Details
#initialize(inputs = nil, id: nil, method: :get, action: '') ⇒ Form
Returns a new instance of Form.
436 437 438 439 440 441 442 443 444 445 446 447 448 |
# File 'lib/htmlcom.rb', line 436 def initialize(inputs=nil, id: nil, method: :get, action: '') @tag = 'form' @htmltag = 'form' @id = id super([:root, {}, [@tag,{}, [@htmltag, {}]]]) form = @doc.root.element(@tag + '/' + @htmltag) form.add inputs if inputs form.attributes[:method] = method.to_s form.attributes[:action] = action end |
Instance Method Details
#add_submit ⇒ Object
450 451 452 453 |
# File 'lib/htmlcom.rb', line 450 def add_submit() submit = Rexle.new(['input', {type: 'submit', value: 'Submit'}]) html_element().add submit end |