Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 03-02-2004, 09:14 PM
Thomas P's Avatar
Thomas P Thomas P is offline
 
Join Date: Oct 2001
Location: Munich, DE
Posts: 365
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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
Reply With Quote
  #2  
Old 03-02-2004, 09:34 PM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hmm ... why would you need this? After a user hits submit the page will be replaced anyway ...
Reply With Quote
  #3  
Old 03-02-2004, 09:39 PM
assassingod's Avatar
assassingod assassingod is offline
 
Join Date: Jul 2002
Posts: 3,337
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by KirbyDE
Hmm ... why would you need this? After a user hits submit the page will be replaced anyway ...
Some people on slow connections might mistake their speed for an error on the site, and hit submit twice.
Reply With Quote
  #4  
Old 03-04-2004, 09:40 PM
Thomas P's Avatar
Thomas P Thomas P is offline
 
Join Date: Oct 2001
Location: Munich, DE
Posts: 365
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yup, plus it's just pretty neat.
Reply With Quote
  #5  
Old 03-06-2004, 06:37 PM
Matt D Matt D is offline
 
Join Date: Aug 2003
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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>
Next, look in your templates for the "<form" tags in which you want to incorporate "submit once" validation, and add this inside the <form tag that is applicable to your needs (ie <form action="something.php" putcodehere>

Code:
onSubmit="submitonce(this)"
Reply With Quote
  #6  
Old 03-06-2004, 07:02 PM
Matt D Matt D is offline
 
Join Date: Aug 2003
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #7  
Old 03-07-2004, 03:32 PM
Thomas P's Avatar
Thomas P Thomas P is offline
 
Join Date: Oct 2001
Location: Munich, DE
Posts: 365
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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:
<script language="javascript">
<!--
var 
postmaxchars $postmaxchars;
function 
validate(theform) {
    if (
theform.message.value=="") {

(...)

            return 
false; }
        else { 
theform.submit.disabled=true; return true;  }
    } else { 
theform.submit.disabled=true; return true; }
}
function 
checklength(theform) {

(...)

//-->
</script
Here are the templates where the code resides:

showthread_replybox (Quick reply hack vB2)
editpost, newreply, newthread, priv_sendprivmsg, priv_forwardmultiple, priv_sendtobuddies


hth
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 08:56 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03792 seconds
  • Memory Usage 2,228KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_code
  • (1)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (7)post_thanks_box
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (7)post_thanks_postbit_info
  • (7)postbit
  • (7)postbit_onlinestatus
  • (7)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete