0

Hello, Folks!!

I am not very experience. I would really appreciate some help as follows:

Goal: Run 2 actions associated with 1 submit, just have to add URLs and they will pull out all the necessary info they need from the form.

Constraints: No access to Database, No Ajax and No PHP.

Problem: Nothing happens even when I use <input type="button" value="submit" onclick="OnBtn1(); OnBtn2();">

I also tried these with no luck:

  1. Two onClick actions one button
  2. Submit single form to two actions

HTML Code:

<script type="text/javascript">
    function postToUrl () {
        document.Form1.action = "https://dB2.com/cgi-bin/b.cgi?"
        document.Form1.submit();
    }
    </script>
    <form id=" Form1" method="POST" action="https://dB1.com/cgi-bin/a.cgi?" onsubmit="postToUrl();">
        <input type="text" id="field1" name="field1">
        <input type="text" id="field2" name="field2">
        <input type="button" value="submit" name="sdb">
    </form>

Can someone please help me? Thank you!

Community
  • 1
  • 1
hbbz040
  • 184
  • 1
  • 1
  • 16

1 Answers1

0

The best solution would be to use ajax, to send the form twice on the submit event.

Maybe you can try to add a hidden form with mirrored values but different action url. This way, when you submit the form it submit the hidden one too.

lithium
  • 229
  • 1
  • 7