Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Preventing double postings on a forum?

Status
Not open for further replies.

Haunter

Programmer
Jan 2, 2001
379
US
I have a forum program that submits data to a flat file database. My problem is that bandwidth is a consideration and limiting its usuage is a must. Can I prevent a page from refreshing and submiting duplicate data by any other means that making sure that the database does not contain the data already. I was hoping for a VBscript or Javascript or Perlscript solution. Any help would be appreciated. I have no trouble acheiving the desired results through PERL but and looking for a simpler way that could possible be done on the client side, like disabling the refresh button, maybe?
 
It seems to me that I recall seeing a posting here or in the Javascript or HTML and CSS forums about preventing double-posting. Unfortunately I don't seem to have sent myself a copy of it for reference. Have you tried searching the forums?
Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
Yes I did try performing a search but I did not come up with anything great.
 
I know the way to do this, but do not have any code on hand for this. Below is probably a simplified version of what you want (but it also could be a little bug ridden). Please forgive any bugs with this code, this should be mainly used as a code base.

Code:
<script>
var submitbutton=0;

function checkandsubmit()
{
    if (submitbutton = 0)
    {
        //check your fields
        submitbutton = 1;
        document.forms[0].submit();
        return true;
    }
    else
    {
        alert('You've already submitted this post.  Please wait as this is processed.');
        return false;
    }
}
 
Thanks Rieekan,

That seems to be the direction I need to go. I just need to test this since the Form is generated by a CGI script I will play with the Idea and let you guys know what I turn up with and repost here.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top