add buttons
This commit is contained in:
parent
ed9d0d02a4
commit
f971ffd5ee
@ -3,15 +3,17 @@ 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 enctype : String
|
getter buttons : Array(FormContent::Button)
|
||||||
getter method : String
|
getter enctype : String
|
||||||
getter name : String
|
getter method : String
|
||||||
property action : String
|
getter name : String
|
||||||
|
property action : String
|
||||||
|
|
||||||
def initialize(node : Node | Myhtml::Node)
|
def initialize(node : Node | Myhtml::Node)
|
||||||
@enctype = node.fetch("enctype", "application/x-www-form-urlencoded")
|
@enctype = node.fetch("enctype", "application/x-www-form-urlencoded")
|
||||||
@ -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