GeekArticles
Database
SQL Server
Database
SQL ServerPreventing Users From Copying Text From and Pasting It Into TextBoxes
<p>
Many websites that support user accounts require users to enter an email address as part of the registration process. This email address is then used as the primary communication
channel with the user. For instance, if the user forgets her password a new one can be generated and emailed to the address on file. But what if, when registering, a user
enters an incorrect email address? Perhaps the user meant to enter <code>me@example.com</code>, but accidentally transposed the first two letters, entering
<code>em@example.com</code>. How can such typos be prevented?
</p><p>
The only foolproof way to ensure that the entered email address is valid is to send them a validation email upon registering that includes a link that, when visited,
activates their account. (This technique is discussed in detail in <a Membership, Roles, and
Profile - Part 11</a>.) The downside to using a validation email is that it adds one more step to the registration process, which will cause some people to bail out on the
registration process. A simpler approach to lessening email entry errors is to have the user enter their email address twice, just like how most registration forms prompt
users to enter their password twice. In fact, you may have seen registration pages that do just this. However, when I encounter such a registration page I usually avoid
entering the email address twice, but instead enter it once and then copy and paste it from the first textbox into the second. This behavior circumvents the purpose of
the two textboxes - any typo entered into the first textbox will be copied into the second.
</p><p>
Using a bit of JavaScript it is possible to prevent most users from copying text from one textbox and pasting it into another, thereby requiring the user to type their
email address into both textboxes. This article shows how to disable cut and paste between textboxes on a web page using the free <a
library</a>. Read on to learn more!
<br /><a More ></a></p>
Sponsored Links
Read Next: Extending ASP.NET Output Caching
Related Topics
Subscribe via RSS
SQL Server
- Naming Database Objects: Part II
- Trace Messages Part V: Trace Cleanup
- Naming Database Objects: Part I
- Multiple-Child Aggregation
- Creating SQL Tables for an Integrating Application Using Dexterity
- SQL Server 2005 Beta 2 Transact-SQL Enhancements
- .NET Rocks! - Brian Larson on SQL Server Reporting Services
- Computing the Trimmed Mean in SQL
- SQL Server 2000 Gains on Oracle
- Separator First Formatting (SFF)
