Announcement (2017-05-07): www.ruby-forum.com is now read-only since I
unfortunately do not have the time to support and maintain the forum any
more. Please see rubyonrails.org/community and ruby-lang.org/en/community
for other Rails- und Ruby-related community platforms.

Hello,
I could not yet figure out how to work around this problem:
agent = WWW::Mechanize.new
page = agent.get("http://www.amazon.com/")
search_form = page.forms.with.name("site-search").first
search_form.field-keywords = "Ruby"
i.e. that the name of the input field is 'field-keywords', so Ruby
thinks (rightfully of course) that I am calling the method 'field' of
the object search_form and of course then the whole thing does not work.
Any suggestions?
TIA,
Peter
__
http://www.rubyrailways.com

Peter Szinek wrote:
> thinks (rightfully of course) that I am calling the method 'field' of> the object search_form and of course then the whole thing does not work.> Any suggestions?
You could try
search_form["field-keyword"] = "Ruby"

On 1/13/07, Peter Szinek <peter@rubyrailways.com> wrote:
> thinks (rightfully of course) that I am calling the method 'field' of> the object search_form and of course then the whole thing does not work.> Any suggestions?
guessing from
http://mechanize.rubyforge.org/classes/WWW/Mechani...
search_form['field-keywords'] = "Ruby"
or you could do
search_form.send(:'field-keywords=', "Ruby")

Stefan Mahlitz wrote:
>> i.e. that the name of the input field is 'field-keywords', so Ruby>> thinks (rightfully of course) that I am calling the method 'field' of>> the object search_form and of course then the whole thing does not work.>> Any suggestions?>> You could try>> search_form["field-keyword"] = "Ruby"
Hey, that worked! Thanks a lot.
SG,
Peter
__
http://www.rubyrailways.com