add Textarea

master
Kanezoh 2021-06-29 21:07:15 +09:00
parent 5631971347
commit 57bad568f7
2 changed files with 12 additions and 0 deletions

View File

@ -2,6 +2,7 @@ require "./form/field"
require "./form/radio_button"
require "./form/check_box"
require "./form/text"
require "./form/textarea"
require "./form/hidden"
require "./form/button"
require "./utils/element_matcher"
@ -70,10 +71,19 @@ class MechanizeCr::Form
fields << FormContent::Text.new(html_node)
when "hidden"
fields << FormContent::Hidden.new(html_node)
when "textarea"
@fields << FormContent::Textarea.new(html_node)
else
fields << FormContent::Field.new(html_node)
end
end
# Find all textarea tags
@node.css("textarea").each do |node|
node = node.as(Myhtml::Node)
next if node["name"].empty?
@fields << FormContent::Textarea.new(node, node.inner_text)
end
end
private def build_query_string(params : Array(Array(String)))

View File

@ -0,0 +1,2 @@
class MechanizeCr::FormContent::Textarea < MechanizeCr::FormContent::Field
end