disabling the submit button after click

Discussion in 'Javascript' started by Willie, Jul 10, 2007.

  1. Willie

    Willie Guest

    Hi All;

    I have a form with multiple buttons and I would like to disable the buttons
    after the user clicks on the button to prevent multiple submitions.

    <input type="submit" name="return1" value="Send To MFG" id="return1"
    onClick='this.disabled=true;this.form.submit()' >

    This works but I do not get the return1 value passed to the action script as
    I do if I just have :

    <input type="submit" name="return1" value="Send To MFG" id="return1" >

    I need this vale to be know which button was pushed. Is there a way of
    passing a value with the form.submit() ?

    Thanks
    Willie
     
    Willie, Jul 10, 2007
    #1
    1. Advertising

  2. On Jul 10, 2:36 pm, "Willie" <> wrote:
    > I have a form with multiple buttons and I would like to disable the buttons
    > after the user clicks on the button to prevent multiple submitions.
    >
    > <input type="submit" name="return1" value="Send To MFG" id="return1"
    > onClick='this.disabled=true;this.form.submit()' >
    >
    > This works but I do not get the return1 value passed to the action script



    Disable it after submitting :
    <input type="submit" name="return1" value="Send To MFG"
    onClick='this.form.submit();this.disabled=true;return false' >

    OR

    <form ... onsubmit="this.return1.disabled=1">
    ....
    <input type="submit" name="return1">
    </form>
     
    scripts.contact, Jul 15, 2007
    #2
    1. Advertising

  3. Willie

    David Mark Guest

    On Jul 15, 5:57 pm, "scripts.contact" <>
    wrote:
    > On Jul 10, 2:36 pm, "Willie" <> wrote:
    >
    > > I have a form with multiple buttons and I would like to disable the buttons
    > > after the user clicks on the button to prevent multiple submitions.

    >
    > > <input type="submit" name="return1" value="Send To MFG" id="return1"
    > > onClick='this.disabled=true;this.form.submit()' >

    >
    > > This works but I do not get the return1 value passed to the action script

    >
    > Disable it after submitting :
    > <input type="submit" name="return1" value="Send To MFG"
    > onClick='this.form.submit();this.disabled=true;return false' >
    >
    > OR
    >
    > <form ... onsubmit="this.return1.disabled=1">
    > ...
    > <input type="submit" name="return1">
    > </form>


    For some reason the OP wants to disable only one of the multiple
    submit buttons, so the second example won't work.
     
    David Mark, Jul 16, 2007
    #3
  4. Willie

    Evertjan. Guest

    David Mark wrote on 16 jul 2007 in comp.lang.javascript:

    >> <form ... onsubmit="this.return1.disabled=1">
    >> ...
    >> <input type="submit" name="return1">
    >> </form>

    >
    > For some reason the OP wants to disable only one of the multiple
    > submit buttons, so the second example won't work.
    >


    Why? I think it will.

    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
     
    Evertjan., Jul 16, 2007
    #4
  5. Willie

    David Mark Guest

    On Jul 16, 5:18 pm, "Evertjan." <> wrote:
    > David Mark wrote on 16 jul 2007 in comp.lang.javascript:
    >
    > >> <form ... onsubmit="this.return1.disabled=1">
    > >> ...
    > >> <input type="submit" name="return1">
    > >> </form>

    >
    > > For some reason the OP wants to disable only one of the multiple
    > > submit buttons, so the second example won't work.

    >
    > Why? I think it will.


    You think it will do what? It will disable just the return1 button,
    which may or may not be the one that was clicked.
     
    David Mark, Jul 16, 2007
    #5
  6. Willie

    Evertjan. Guest

    David Mark wrote on 16 jul 2007 in comp.lang.javascript:

    > On Jul 16, 5:18 pm, "Evertjan." <> wrote:
    >> David Mark wrote on 16 jul 2007 in comp.lang.javascript:
    >>
    >> >> <form ... onsubmit="this.return1.disabled=1">
    >> >> ...
    >> >> <input type="submit" name="return1">
    >> >> </form>

    >>
    >> > For some reason the OP wants to disable only one of the multiple
    >> > submit buttons, so the second example won't work.

    >>
    >> Why? I think it will.

    >
    > You think it will do what? It will disable just the return1 button,
    > which may or may not be the one that was clicked.


    Yes, "OP wants to disable only one of the multiple submit buttons".

    I think the whole idea is aweful.

    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
     
    Evertjan., Jul 16, 2007
    #6
    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. Kevin Spencer
    Replies:
    2
    Views:
    7,336
    Ananda Sim
    Aug 30, 2003
  2. Mark
    Replies:
    1
    Views:
    1,792
  3. Chris  Ashley
    Replies:
    1
    Views:
    2,848
    =?Utf-8?B?RGF2aWQgSmVzc2Vl?=
    Dec 16, 2005
  4. GS
    Replies:
    11
    Views:
    39,374
  5. Replies:
    3
    Views:
    1,323
Loading...

Share This Page