WWW::Mech: form submission fails silently

WWW::Mech: form submission fails silently

am 28.03.2005 23:32:22 von kynn

Hi!

I am using WWW::Mechanize to automate a transaction. At one step I
must submit the contents of a form whose submit button has an unusual
name. It's something like

0 HTML::Form::SubmitInput=HASH(0x89f5844)
'/' => '/'
'name' => 'reviewed'
'type' => 'submit'
'value' => 'Been there done that'
'value_name' => ''

When I perform this transaction manually, clicking on this button
results in a persistent change in the information that is stored in
the server under my account, but when it is done through
WWW::Mechanize, no change occurs, even though the is_success() method
returns true. (This form has only one submit button; the other input
elements in this form are all hidden fields.)

I have tried various ways of submitting the form, but they are all
variants of:

die "Update failed\n"
unless $m->submit_form( form_number => 3 )->is_success;

where $m is the WWW::Mechanize object.

I noticed that request for the manual submission included the fragment
'reviewed=Been+there+done+that', which gave me the idea of doing this

my $val = 'Been there done that';
die "Update failed\n"
unless $m->submit_form( form_number => 3,
fields => { reviewed => $val }
)->is_success;

but it made no difference. If I step through the code with the
debugger I see that, despite specifying the "reviewed" field in the
call to submit_form, the request generated by WWW::Mechanize does not
include the 'reviewed=Been+there+done+that' substring, or anything
like it.

What am I doing wrong?

Thanks!

kj

Re: WWW::Mech: form submission fails silently

am 29.03.2005 10:03:03 von peter.stevens

Try using click() instead. Depending on how the programmer checks that
the form has been submitted, he may not notice that the form has been
filled in.

Cheers,

Peter

kynn@panix.com wrote:

>Hi!
>
>I am using WWW::Mechanize to automate a transaction. At one step I
>must submit the contents of a form whose submit button has an unusual
>name. It's something like
>
> 0 HTML::Form::SubmitInput=HASH(0x89f5844)
> '/' => '/'
> 'name' => 'reviewed'
> 'type' => 'submit'
> 'value' => 'Been there done that'
> 'value_name' => ''
>
>When I perform this transaction manually, clicking on this button
>results in a persistent change in the information that is stored in
>the server under my account, but when it is done through
>WWW::Mechanize, no change occurs, even though the is_success() method
>returns true. (This form has only one submit button; the other input
>elements in this form are all hidden fields.)
>
>I have tried various ways of submitting the form, but they are all
>variants of:
>
> die "Update failed\n"
> unless $m->submit_form( form_number => 3 )->is_success;
>
>where $m is the WWW::Mechanize object.
>
>I noticed that request for the manual submission included the fragment
>'reviewed=Been+there+done+that', which gave me the idea of doing this
>
> my $val = 'Been there done that';
> die "Update failed\n"
> unless $m->submit_form( form_number => 3,
> fields => { reviewed => $val }
> )->is_success;
>
>but it made no difference. If I step through the code with the
>debugger I see that, despite specifying the "reviewed" field in the
>call to submit_form, the request generated by WWW::Mechanize does not
>include the 'reviewed=Been+there+done+that' substring, or anything
>like it.
>
>What am I doing wrong?
>
>Thanks!
>
>kj
>
>
>