hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Programming Discussion : Programming Tutorials : Preventing "JavaScript disabled users" to send unvalidated forms.
Reply

Programming Tutorials How-Tos related to programming, databases, and the like.
Forum Jump

Preventing "JavaScript disabled users" to send unvalidated forms.

Reply Post New Thread In Programming Tutorials Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old 07-27-2005, 08:35 AM
BurakUeda BurakUeda is offline
Retarded Noodleator
 
Join Date: Oct 2004
Location: Shimonoseki
Posts: 2,100

Preventing "JavaScript disabled users" to send unvalidated forms.


This simple code I wrote, and just wanted to share.

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:
<SCRIPT TYPE="TEXT/JAVASCRIPT" LANGUAGE="JAVASCRIPT">
function 
enable(){
var 
formQ document.forms.length;
for(var 
xx=0xx<formQxx++) {
    var 
formElementQ document.forms[xx].elements.length;
        for(var 
yy=0yy<formElementQyy++){
            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:
<BODY onLoad="enable()">
<
INPUT TYPE="Submit" NAME="Send" DISABLED

Reply With Quote


Sponsored Links
  #2  
Old 07-27-2005, 03:14 PM
adaml adaml is offline
Web Hosting Guru
 
Join Date: Oct 2002
Location: York, United Kingdom
Posts: 260


This might come in use one day!

Reply With Quote
  #3  
Old 01-04-2006, 01:18 PM
$_patch $_patch is offline
Junior Guru Wannabe
 
Join Date: Jan 2006
Posts: 31
for user inputs, there are two stages of test that must be done...

1. on client side, this will lessen the frustration of the user. he wants to know immediately the error.

2. server side, for users that bypass the client page, you must also check the inputs on the server side.

more important checking is on #2 because all your system depends on that checking. the #1 checking is only for improving user experience.

Reply With Quote
Sponsored Links
Reply

Related posts from TheWhir.com
Title Type Date Posted
Facebook's Recently Acquired Mobile App Platform Parse Launches Web Hosting for Developers Web Hosting News 2013-05-08 10:49:17
Data Center Outage Hits 400,000 Clients of Email Marketing Tool MailChimp Web Hosting News 2012-01-04 22:04:19
OpenDNS's New Technology Improves DNS Traffic Security Web Hosting News 2011-12-06 18:35:36
Browsers Disable DigiNotar After Rogue Certificate Used in Gmail Attack Web Hosting News 2011-08-30 14:20:17
US-CERT Publishes Recommendations for Preventing Cyber Security Attacks Web Hosting News 2011-07-22 19:07:35


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

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
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?