mechanize form.fields.name

D

Daly

Hi,

I'm using mechanize version 0.9.2, and am having an issue with
form.fields.name("foo")

the code looks something like:

agent = WWW::Mechanize.new
page = agent.get("mypage.html")
form = page.form('myform')

Now I need to set the value of a select box in the form. The select
box name is report_type. The options in the select box are "Reports"
and "Advanced Reports".

using form.report_type gives me "1"
(rdb:1) form.report_type
"1"

Reading the documentation wasn't helpful, but I saw another post that
says you can do:

form.fields.name("report_type"), but that gives me:
(rdb:1) form.fields.name('report_type')
NoMethodError Exception: undefined method `name' for #<Array:
0x2fdc33c>

because form.fields IS an array :)

Any pointers on how to set the select box's value back and forth
between Reports and Advanced Reports?

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top