The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
Deactivate Submit Button after clicking it
Hello,
saw this on an IPB and must say: Neato! Checked the JS, seems easy, but didn't werk on my testing forum. Is there a hackette for this around here? thx, -Tom |
#2
|
||||
|
||||
Hmm ... why would you need this? After a user hits submit the page will be replaced anyway ...
|
#3
|
||||
|
||||
Quote:
|
#4
|
||||
|
||||
Yup, plus it's just pretty neat.
|
#5
|
|||
|
|||
Put this into the <head> </head> part of your vBulletin forum
Code:
<script> function submitonce(theform){ //if IE 4+ or NS 6+ if (document.all||document.getElementById){ //screen thru every element in the form, and hunt down "submit" and "reset" for (i=0;i<theform.length;i++){ var tempobj=theform.elements[i] if(tempobj.type.toLowerCase()=="submit"||tempobj.type.toLowerCase()=="reset") //disable em tempobj.disabled=true } } } </script> Code:
onSubmit="submitonce(this)" |
#6
|
|||
|
|||
Well, my instructions were pretty blunt, so I'll follow up with some more specific instructions...
Place the <head> </head> part of the code into your header include field (this can be found on the general style editing page in your vBulletin admin control panel). Next, go to the template section and open the newthread template. Find where the template says <form Inside this tag replace onSubmit="return validate(this)" with onSubmit="return submitonce(this)" This replaces a javascript dialog box that will say "You didn't fill in the fields" with the deactivate submit button on the touch of the button. It will still validate the fields manually and display an error message on the next page saying they need to go back and fill in all the fields. I'm no javascript expert, so I didn't research or even attempt ways of incorporating both types of validation into one check... If you want that, you'll need to wait for someone to contribute that, or find a way yourself You'll need to take the above steps in all applicable templates that you'd like the form submit button disabled on click (like "newreply", "newpoll" etc...). I suggest searching for all templates that have <form in it and adding / replacing the code as outlined above. |
#7
|
||||
|
||||
Okay, thanks!
What I did now is to insert the following code in the JavaScript parts of the newreply and newthread (editpost, pm ...) template etc. Just insert this snippet theform.submit.disabled=true; before the return true; part. E.g.: PHP Code:
showthread_replybox (Quick reply hack vB2) editpost, newreply, newthread, priv_sendprivmsg, priv_forwardmultiple, priv_sendtobuddies hth |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|