action url change on submit form

Discussion in 'Javascript' started by MZ, May 23, 2007.

  1. MZ

    MZ Guest

    Hello!

    Is it possible to change URL form action on submit form...

    I have tried such code:


    <script language="JavaScript" type="text/javascript">
    function changeURL()
    {
    document.location='http://www.XXX.com/'+'?dzial='+document.getElementById('dzial').value+'&pdzial='+document.getElementById('pdzial').value;}</script><form name="formularz" id="formularz" method="post"action="http://www.XXX.com/" onKeyUp="sprawdzajForm_spec();"> Dept:<input name="dzial" id="dzial" size="10" maxlength="9" type="text"value="11"> Subdept:<input name="pdzial" id="pdzial" size="10" maxlength="9"type="text" value="b"> <input id='sendOgl' style="display:none;" type="button"onclick="changeURL();wyslij();" value="Wyslij ogloszenie" class="wyslijOgl"></form>but it doesn`t work well and it didn`t change my URL form action .Thank you in advance for any commentsKindest regardsM.
     
    MZ, May 23, 2007
    #1
    1. Advertising

  2. MZ

    Erwin Moller Guest

    MZ wrote:

    > Hello!
    >
    > Is it possible to change URL form action on submit form...
    >
    > I have tried such code:
    >
    >
    > <script language="JavaScript" type="text/javascript">
    > function changeURL()
    > {
    >

    document.location='http://www.XXX.com/'+'?dzial='+document.getElementById('dzial').value+'&pdzial='+document.getElementById('pdzial').value;}</script><form
    > name="formularz" id="formularz" method="post"action="http://www.XXX.com/"
    > onKeyUp="sprawdzajForm_spec();"> Dept:<input name="dzial" id="dzial"
    > size="10" maxlength="9" type="text"value="11"> Subdept:<input
    > name="pdzial" id="pdzial" size="10" maxlength="9"type="text" value="b">
    > <input id='sendOgl' style="display:none;"
    > type="button"onclick="changeURL();wyslij();" value="Wyslij ogloszenie"
    > class="wyslijOgl"></form>but it doesn`t work well and it didn`t change my
    > URL form action .Thank you in advance for any commentsKindest regardsM.


    Hi,

    Your posting came through scrambled in my newsreader.
    But to change the action is a form is easy:

    <form action="script1.php" name="myForm">
    <input type="text" name="firstname">
    <input type="submit" value="submit to original script">
    <input type="button" value="submit to script2.php"
    onClick='document.forms.myForm.action="script2.php";
    document.forms.myForm.submit();'>
    </form>

    Regards,
    Erwin Moller
     
    Erwin Moller, May 23, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jiho Han
    Replies:
    4
    Views:
    6,509
    Michael Ramey
    Feb 11, 2004
  2. TheOne
    Replies:
    12
    Views:
    15,447
    Steven Cheng[MSFT]
    Feb 17, 2005
  3. Joe Bloggs
    Replies:
    1
    Views:
    952
    Sudsy
    Aug 3, 2003
  4. John
    Replies:
    0
    Views:
    986
  5. Replies:
    3
    Views:
    754
Loading...

Share This Page