Each form is represented as an HTML::Form object, so you could manipulate the form directly using those methods:
my $form = $mech->form_number(2); $form->action(URI->new_abs('somewhere_else.aspx?appended_stuff', $mech->uri)); $mech->submit_button(form_number => 2); The action method requires a full URI, so that's what the "URI->new_abs" part provides. Otherwise, you could apply the large stone hammer approach of rewriting the HTML yourself using the update_html method: my $html = $mech->content; $html =~ s{\Qaction="start.aspx"} {action="somewhere_else.aspx?appended_stuff"}; $mech->update_html($html); $mech->submit_button(form_number => 2); ____________________________________________________________ Eamon Daly ----- Original Message ----- From: "Neville Aga" <[EMAIL PROTECTED]> To: <libwww@perl.org> Sent: Tuesday, November 07, 2006 9:36 PM Subject: mech and javascript modifying form post action I am using mech to fill out a form. The problem is javascript is used to alter the form before it is submitted. That is the html of the form initially has <form method=post action=start.aspx>. When the user clicks, javascript alters the form before submission to be <form method=post action=somewhere_else.aspx?appended_stuff>. Since mech does not understand javascript I cant simply click() or submit(). So, how do I fill out the form in mech and then change the target before I use click() or submit? I can use standard perl to get somewhere_else and appended_stuff, so that's not the problem. The problem is that I don't know how to change mechs understanding of the form before submission. Any ideas? Thanks, Neville