Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Prevent user from entering punctuation

Reply
Thread Tools

Prevent user from entering punctuation

 
 
Jonathan N. Little
Guest
Posts: n/a
 
      06-18-2006
Jukka K. Korpela wrote:
> Jonathan N. Little <(E-Mail Removed)> scripsit:
>
>> Before it is posted, your can use JavaScript to check the input, but
>> that is no guarantee because the user may have JavaScript disabled.
>> You should *always* check user input upon the receiving end at the
>> server-side script.

>
> In this particular case, the check should probably be made _only_ in the
> server.
>
> As a rule, it is a good idea to consider setting up client-side checking
> as well, after you have designed and implemented the server-side check.
> Immediate checking is good for usability and accessibility: the user
> gets an error message at an early phase where he remembers what he just
> did and has the context and position in front of his years, literally or
> figuratively.
>
> However, double checking tends to be expensive in terms of
> implementation and maintenance work. You normally use two quite
> different programming languages, JavaScript for client-side checking and
> something else for server-side checking. This means duplicate coding;
> only the overall logic is the same. Moreover, any changes need to be
> implemented twice, and this means that some day you (or you successor as
> the maintainer) will forget this. Testing needs to be duplicated, too -
> with scripting enabled and scripting disabled. Testing the client-side
> checking is problematic, since there are differences between browsers in
> JavaScript implementations.
>


I agree that it makes more work for the designer, but the benefit is
that it can give an advance tip to the user. I see benefit is
accommodating the user. If you make it more convenient or accessible for
them the more likely you will get their business! On dialup from
experience it can be a real ****er to only discover your error after you
posted the form and will have to do the process all over again.

On the implementation side I took the time to create a pair of script
PHP and JavaScript , I created an validation class object in each and
the base validation is set in my PHP and the PHP object creates upon
loading the document the JavaScript to load the same checking values
into the JavaScript object to keep everything synced. It was worth the
initial effort so now I only have to include the PHP class and attach
the JavaScript class then in the doc setup up the PHP object. The rest
is done automatically and if the user has JavaScript enabled client-side
checking will be enabled.

What one must be careful of it that their JavaScript validation does not
cause an endless loop when can happen with improper blur|focus handling...

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
 
Reply With Quote
 
 
 
Reply

Thread Tools

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
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
prevent from entering some bad websites after searching Mike Computer Support 11 04-10-2009 11:54 PM
restrict the user entering nonalphanumeric keys? =?Utf-8?B?Qw==?= ASP .Net 1 06-13-2007 10:31 PM
Prevent entry of punctuation PW ASP General 1 06-18-2006 07:48 AM
IOS user authentication when entering enable mode MayaShani@gmail.com Cisco 3 03-13-2006 07:07 AM
Prevent entering data into DB twice =?Utf-8?B?bWdAdGhld29ybGQuY29t?= ASP .Net 3 06-09-2004 07:48 PM



Advertisments