add buttons
This commit is contained in:
parent
ed9d0d02a4
commit
f971ffd5ee
@ -3,11 +3,13 @@ require "./form/radio_button"
|
|||||||
require "./form/check_box"
|
require "./form/check_box"
|
||||||
require "./form/text"
|
require "./form/text"
|
||||||
require "./form/hidden"
|
require "./form/hidden"
|
||||||
|
require "./form/button"
|
||||||
|
|
||||||
class MechanizeCr::Form
|
class MechanizeCr::Form
|
||||||
getter fields : Array(FormContent::Field)
|
getter fields : Array(FormContent::Field)
|
||||||
getter checkboxes : Array(FormContent::CheckBox)
|
getter checkboxes : Array(FormContent::CheckBox)
|
||||||
getter radiobuttons : Array(FormContent::RadioButton)
|
getter radiobuttons : Array(FormContent::RadioButton)
|
||||||
|
getter buttons : Array(FormContent::Button)
|
||||||
getter enctype : String
|
getter enctype : String
|
||||||
getter method : String
|
getter method : String
|
||||||
getter name : String
|
getter name : String
|
||||||
@ -19,6 +21,7 @@ class MechanizeCr::Form
|
|||||||
@fields = Array(FormContent::Field).new
|
@fields = Array(FormContent::Field).new
|
||||||
@checkboxes = Array(FormContent::CheckBox).new
|
@checkboxes = Array(FormContent::CheckBox).new
|
||||||
@radiobuttons = Array(FormContent::RadioButton).new
|
@radiobuttons = Array(FormContent::RadioButton).new
|
||||||
|
@buttons = Array(FormContent::Button).new
|
||||||
@action = node.fetch("action", "")
|
@action = node.fetch("action", "")
|
||||||
@method = node.fetch("method", "GET").upcase
|
@method = node.fetch("method", "GET").upcase
|
||||||
@name = node.fetch("name", "")
|
@name = node.fetch("name", "")
|
||||||
@ -80,6 +83,12 @@ class MechanizeCr::Form
|
|||||||
checkboxes << FormContent::CheckBox.new(html_node, self)
|
checkboxes << FormContent::CheckBox.new(html_node, self)
|
||||||
when "radio"
|
when "radio"
|
||||||
radiobuttons << FormContent::RadioButton.new(html_node, self)
|
radiobuttons << FormContent::RadioButton.new(html_node, self)
|
||||||
|
when "button"
|
||||||
|
@buttons << FormContent::Button.new(html_node)
|
||||||
|
when "submit"
|
||||||
|
@buttons << FormContent::SubmitButton.new(html_node)
|
||||||
|
when"reset"
|
||||||
|
@buttons << FormContent::ResetButton.new(html_node)
|
||||||
when "text"
|
when "text"
|
||||||
fields << FormContent::Text.new(html_node)
|
fields << FormContent::Text.new(html_node)
|
||||||
when "hidden"
|
when "hidden"
|
||||||
|
Loading…
Reference in New Issue
Block a user