add form property to checkbox
parent
7d8c56e3f2
commit
eec62fade2
|
@ -61,7 +61,7 @@ class MechanizeCr::Form
|
||||||
type = (html_node["type"] || "text").downcase
|
type = (html_node["type"] || "text").downcase
|
||||||
case type
|
case type
|
||||||
when "checkbox"
|
when "checkbox"
|
||||||
@checkboxes << MechanizeCr::FormContent::CheckBox.new(html_node)
|
@checkboxes << MechanizeCr::FormContent::CheckBox.new(html_node, self)
|
||||||
else
|
else
|
||||||
@fields << MechanizeCr::FormContent::Field.new(html_node)
|
@fields << MechanizeCr::FormContent::Field.new(html_node)
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
class MechanizeCr::FormContent::CheckBox < MechanizeCr::FormContent::Field
|
class MechanizeCr::FormContent::CheckBox < MechanizeCr::FormContent::Field
|
||||||
property :checked
|
property :checked, :form
|
||||||
|
|
||||||
def initialize(node : Node | Myhtml::Node, value = nil)
|
def initialize(node : Node | Myhtml::Node, form : MechanizeCr::Form)
|
||||||
@checked = !!node["checked"]
|
@checked = !!node["checked"]
|
||||||
super(node, value)
|
@form = form
|
||||||
|
super(node)
|
||||||
end
|
end
|
||||||
|
|
||||||
def check
|
def check
|
||||||
|
|
Loading…
Reference in New Issue