SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Oct 2001
    Location
    Lisbon
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to prevent duplicate inserts on click of submit mor ethan ones

    I´ve got one problem in one page that i have for homebanking. I have 3 buttons, functions in all ,and they´re called in a Js. The third button to submit the document works weel, but if i click 2 or 3 or more times the same button work is function all the times is clicked. I need to make the button work only one time and no more... Please help me !
    a part of the code:

    jsp

    <center>
    <table border="0" cellpadding="0" cellspacing="2">
    <tr>
    <td valign="top"><a href="java script:limpar();"><img src="images/limpar.gif" border="0" alt="Apagar"></a></td>
    <td valign="top"><a href="java script:history.back();"><img src="images/cancelar.gif" border="0" alt="Cancelar"></a></td>
    <td valign="top"><a href="java script:ValidarP(document.confirmar);"><img src="images/continuar.gif" border="0" alt="Continuar"></a></td>


    </tr>
    </table>
    </form>
    </center>
    </body>
    </html>


    and the js


    function ValidarP(form)
    {

    var f = document.forms[0];
    var ok = true;
    if (f.ClaveOperacion.value == "")
    {
    alert ("Deve preencher o PIN de Operações.");
    f.ClaveOperacion.select();
    f.ClaveOperacion.focus();
    ok = false;
    }
    if (ok) f.submit();
    }


    thanks

    ------------------
    alex vasconcelos





    Alex Vasconcelos (Portugal)

  2. #2
    SitePoint Wizard Ian Glass's Avatar
    Join Date
    Oct 2001
    Location
    Beyond yonder
    Posts
    2,384
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Last edited by Ian Glass; Oct 30, 2001 at 16:57.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •