UBB.Dev
Posted By: 3DSHROOM_dup1 Single Submit Click - 04/18/2002 1:19 AM
I've seen other BB software where once you have clicked the submit button it is then disabled to cut down on double posts. Just thought this would be good for those who have slower boards combined with impatient people. []/forum/images/icons/rolleyes.gif[/]
Posted By: Muhammad Re: Single Submit Click - 04/19/2002 4:56 PM
The double posts won't get entered if they are using the submit button... the post has to be different, or else it will pick it up and not allow a second post.
Posted By: JustDave Re: Single Submit Click - 04/19/2002 5:10 PM
I think the requested result is to keep them from sending information to the server a second time to keep the server load down. Although the duplicate post isn't entered it did use up some server time to figure that out.

This is rough but this is what I think would be needed:

Add this to the header insert include -

<script language=javascript>
var subonce = 1;
function doSub () {

if (subonce) {
subonce = 0;
document.replier.submit();
}
else {
alert('Please be patient... Thanks.');
return false;
}

}
</script>


Then replace your submit button type which should be labled "submit" with "button" and then add this to the same tag:

onClick="doSub()"



I think that should do it. I would have to actualy do it to see if it works though... lol I think it will []/forum/images/icons/wink.gif[/]
Posted By: Muhammad Re: Single Submit Click - 04/19/2002 5:20 PM
Have you tested that on netscape? I'm not sure if it will show up at all with "button" in there. []/forum/images/icons/smile.gif[/]
Posted By: JustDave Re: Single Submit Click - 04/19/2002 5:24 PM
It should show up. I believe there are only 3 specific types of buttons. Submit, Reset and Button. The latter used when defining a specific function for it. []/forum/images/icons/smile.gif[/]

I'll give it a whirl and make sure though. []/forum/images/icons/smile.gif[/]
Posted By: JustDave Re: Single Submit Click - 04/19/2002 5:28 PM
Seems to be working for me... []/forum/images/icons/smile.gif[/]
Posted By: Muhammad Re: Single Submit Click - 04/19/2002 5:43 PM
Right... so long as it isn't "button" it should work... We have had problems with "button" in netscape.
Posted By: JustDave Re: Single Submit Click - 04/19/2002 5:47 PM
I have never had a problem using "button" with NS 4.7+ but perhaps older versions had the problem?

Posted By: AllenAyres Re: Single Submit Click - 04/19/2002 5:52 PM
your code looks good dave, we've had several versions of that for ubb, I'll hunt it down later []/forum/images/icons/smile.gif[/]
Posted By: Muhammad Re: Single Submit Click - 04/19/2002 5:56 PM
4.7, 6.0, both had problems. []/forum/images/icons/smile.gif[/] We changed it to submit and it worked...
Posted By: JustDave Re: Single Submit Click - 04/19/2002 5:56 PM
Thanks []/forum/images/icons/smile.gif[/]

I should add that the javascript is ment for 6.0 because the form tag has been given a name "replier" otherwise all affected scripts would need to be edited and name="replier" added to the form tags. []/forum/images/icons/smile.gif[/]
Posted By: 3DSHROOM_dup1 Re: Single Submit Click - 04/19/2002 7:07 PM
Great, thanks!
Posted By: Maze Re: Single Submit Click - 04/19/2002 7:50 PM
Good idea. But why not remove the button or make it invisible instead of the alert-box? Just a thought...
Posted By: JustDave Re: Single Submit Click - 04/19/2002 8:26 PM
The button can't be removed till after the page is generated again so to keep a person from hitting the button more than once while the page is trying to post causes the same information to be sent twice. Using the javascript to check before sending keeps this from happening. []/forum/images/icons/smile.gif[/]

You could remove the alert box and just return the false statement. Nothing more will happen and the information will still only be submitted once. I just figured it would give the impatient people more incentive to wait... lol []/forum/images/icons/wink.gif[/]
© UBB.Developers