in reply to Re: Re: Re: HTTP::Request(POST, ...)
in thread HTTP::Request(POST, ...)

Thanks alot, Corion. I use WWW::Mechanize, it makes my life much easy. But I have a problem here: In a page responsed from server, there is a form in which some fields and two buttons are defined like these: --------------------------- <FORM name="frmSaveUser" action='SaveUser" method="post"> ..... <BUTTON class="pbutton" type="button" onclick="validate(document.frmSaveUser)"> Save</BUTTON> <BUTTON class="pbutton" type="button" onclick="history.back()"> Cancel</BUTTON> ....
</FORM> --------------- I fill fields and call $browser->click_button(number => 1); I got the error: "can't call method "click" on an undefined value at /usr/lib/perl5/site_perl/5.8.0/WWW/Mechanize.pm line 722" On the button defined above, there is a JavaScript funcation defined to check the validation of filled values. Do I do something wrong? or what should I do to make it work? Thanks again Quency

Replies are listed 'Best First'.
Re^5: HTTP::Request(POST, ...)
by Corion (Patriarch) on Jun 04, 2004 at 19:23 UTC

    You will need to understand what the Javascript does, and then program that thing in Perl. There is no Javascript interpreter plus object model for Perl.

    In the documentation of WWW::Mechanize::Shell is some hint as to how you can maybe work around this problem.

    $agent->current_form->push_input( submit => { name => "submit", value +=>"submit" } );

    But most likely, you will have to look at exactly what the Javascript code does. Maybe even $agent->current_form->submit() already works in your case.