vit has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks,
Is there any way to submit same form to 2 or more actions with one submit button.

Replies are listed 'Best First'.
Re: submit to muliple actions
by samtregar (Abbot) on Feb 17, 2008 at 18:26 UTC
    Yes. You could do it with iframes or with AJAX calls. Are you using an AJAX framework already?

    -sam

    PS: This is not a Perl question. You might get better answers asking somewhere else.

      No, I don't. Could you give me a hint or a simple example to start with.
        Sure. I'd use Prototype to do this. If I wanted to submit a form with two fields "foo" and "bar" to two scripts, "one.pl" and "two.pl" I'd do:

        var params = { foo: $('foo').value, bar: $('bar').value }; new Ajax.Request("one.pl", { parameters: params, onSuccess: handle_one }); new Ajax.Request("two.pl", { parameters: params, onSuccess: handle_two });

        Then I'd write "handle_one()" and "handle_two()" to do something with the return values from the scripts. Also, you'll want onFailure and onException handlers. But that's the basic idea.

        Reluctant JavascriptMonk,
        -sam

Re: submit to muliple actions
by ikegami (Patriarch) on Feb 17, 2008 at 18:45 UTC
    Your chosen solution smells fishy. What are you really trying to do?
      Is it a good idea to use this kind of words...?
      Anyway, like I said I need to process one request in two script.

        Don't you want to take two actions on the same script? Or even more possible actions based on form conditionals.

Re: submit to muliple actions
by marcussen (Pilgrim) on Feb 17, 2008 at 22:24 UTC
    You could submit to a script that uses WWW::Mechanize to submit the data to any number of third party scripts.
    while ( whoring ){ for ( xp ){ grep /the source/,@perlmonks; }}