Domain Discussion Board

Go Back   Domain Discussion Board > General > Tutorials

 
Reply
 
LinkBack Thread Tools Display Modes
Preventing "JavaScript disabled users" to send unvalidated forms.
Old
  (#1 (permalink))
bbalegere
 
Status:
Posts: n/a
Points: 0
Bank: 0
Total Points: 0
Donate
Preventing "JavaScript disabled users" to send unvalidated forms. - 09-21-2006, 06:10 AM

Actually you can (and you should anyway) always check the post variables in the second page, but this code prevents users clicking "submit" buttons if JavaScript disabled:

PHP Code:
Quote:
<SCRIPT TYPE="TEXT/JAVASCRIPT" LANGUAGE="JAVASCRIPT">
function enable(){
var formQ = document.forms.length;
for(var xx=0; xx<formQ; xx++) {
var formElementQ = document.forms[xx].elements.length;
for(var yy=0; yy<formElementQ; yy++){
if(document.forms[xx].elements[yy].type.toLowerCase()=="submit")
{
document.forms[xx].elements[yy].disabled = false;
}
}
}
}
</SCRIPT>

Put this on top of your page, and call the function from BODY tag. You also have to disable all your submit buttons:

PHP Code:
Quote:
<BODY onLoad="enable()">
<INPUT TYPE="Submit" NAME="Send" DISABLED>

Last edited by mtorregiani : 09-21-2006 at 06:25 AM.
   
Reply With Quote
Reply


Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Points Per Thread View: 1.0
Points Per Thread: 15.0
Points Per Reply: 5.0



Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 ©2007, Crawlability, Inc.