in reply to LWP multi-form POST

First, when a human enters data in a regular web browser and then clicks Submit, only one form will be submitted, the form that the Submit button comes from.

Second, have you looked at WWW::Mechanize?


$;=sub{$/};@;=map{my($a,$b)=($_,$;);$;=sub{$a.$b->()}} split//,".rekcah lreP rehtona tsuJ";$\=$ ;->();print$/

Replies are listed 'Best First'.
Re: Re: LWP multi-form POST
by Vautrin (Hermit) on Feb 10, 2004 at 20:56 UTC
    A lot of sites use javascript to submit multiple forms. This allows all sorts of things, including creating hoops that make it harder to use a language like perl to spider a site.

    Want to support the EFF and FSF by buying cool stuff? Click here.
      A lot of sites use javascript to submit multiple forms

      Can you site an example of a site that does this? (I'm not denying it -- I've seen all sorts of weird things done with scripts that ought not to be possible. I'm just curious how it's accomplished, given that normally the submission of a form causes the browser to stop executing the scripts on that page as it goes on to fetch the new form-result page.)

      This allows all sorts of things, including creating hoops that make it harder to use a language like perl to spider a site.

      I suspect it's possible to get around this using WWW::Mechanize and maybe Clone::PP, but I'd have to see the details of what the scripts on the site are doing.


      $;=sub{$/};@;=map{my($a,$b)=($_,$;);$;=sub{$a.$b->()}} split//,".rekcah lreP rehtona tsuJ";$\=$ ;->();print$/

        A lot of sites use javascript to submit multiple forms

        Can you site an example of a site that does this? (I'm not denying it -- I've seen all sorts of weird things done with scripts that ought not to be possible. I'm just curious how it's accomplished, given that normally the submission of a form causes the browser to stop executing the scripts on that page as it goes on to fetch the new form-result page.)

        Basically, if you use a <form NAME="foo"> tag in the forms declaration you can use:

        document.foo.submit();

        To submit a form. Most of the time this is used to create hyperlinks which submit a form, or forms that submit themselves if you click on a select box, for instance. However, it can be extended by creating a class of functions to submit multiple forms at the same time. I don't have any examples off the top of my head, but if I come across one I will be sure to post it.


        Want to support the EFF and FSF by buying cool stuff? Click here.