Results 1 to 5 of 5

Thread: Hitting submit more that once.

  1. #1

    Thread Starter
    Member
    Join Date
    Sep 2000
    Location
    New Orleans, LA
    Posts
    37
    I have two problems, both dealing with the same thing, I think theyre pretty common, so there might be some 'canned' solution:

    I have a forum system on my site that I wrote, but heres the probs i cant figure out:


    1:
    Users hitting submit twice when posting (impatient little buggers!), and usually this will result in their post getting submitted twice.

    2:
    people who post, then out of stupidity, hit the back button to try to edit their post and hit submit again, thus posting an original version and an edited version.


    I see that a lot of sites have the page expire on submission to work around the second problem, how do you do that?

    as for the first one, my kneejerk reaction is to test the database to see if a record with the exact same content has been posted (excluding the index of course), and if so, dont write it again, but i wanted to check to see if there is a easier way.


    thanks in advance!

  2. #2
    Fanatic Member Ianpbaker's Avatar
    Join Date
    Mar 2000
    Location
    Hastings
    Posts
    696
    Hi glitch13

    with the expiring of pages if you are using asp for this foeum of yours, you can put this at the top of you code

    Response.Expires = 1

    as for your first problem, there isn't really any easy way of doing it apart from as you said.

    Hope this helps

    Ian

    Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!

  3. #3
    Frenzied Member sebs's Avatar
    Join Date
    Sep 2000
    Location
    Aylmer,Qc
    Posts
    1,606
    for youyr first prob, try:

    <input type=button name=submit onClick="mySubmit();">

    and make a javascript function,

    function mySubmit(){
    var isSubmit
    if (isSubmit != True){
    myForm.submit();
    }else{
    alert('You already hit the submit dude!');
    }


    try this and let us know!!

  4. #4

    Thread Starter
    Member
    Join Date
    Sep 2000
    Location
    New Orleans, LA
    Posts
    37
    thanks, but I just want it to be transparent, like they can keep hitting submit, but only the first click will count.

  5. #5
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844
    just modify Sebs code:

    function mySubmit(){
    var isSubmit
    if (isSubmit != True){
    myForm.submit();
    }else{
    // do nothing
    }

Posting Permissions

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



Click Here to Expand Forum to Full Width