Thursday, May 9th, 2013

Validating Dropdown Lists

A drop down list is one of the easiest of input fields to validate in JavaScript since you already know all the values that the field can have and presumably all or all but one of them are valid. Where you need to require that visitors make a selection is the only time you would [...]

Wednesday, December 19th, 2012

Problems with Forms

If only some of your form fields are actually getting to the server then there are a number of things that might be wrong. In this article we consider many of the possible causes and how to fix them. Problems with Forms

Tuesday, December 11th, 2012

Creating ‘valid’ HTML 5

HTML 5 currently shares a doctype with prior versions of HTML such as HTML 2. This short version of the doctype simply says that the page is written in HTML without specifying which version. Since we don’t want any antiquated HTML 3.2 tags in our page when we are using HTML 5 we need an [...]

Saturday, November 17th, 2012

Everything is Tainted Until Proved Otherwise

This article is the first part of the introduction to my series on PHP Security. The introductory articles cover some of the basic concepts of how to apply security with the later articles covering more specific examples of how to apply security. This first article introduces data validation. Everything is Tainted Until Proved Otherwise

Wednesday, October 24th, 2012

Validating a Date

Validating a date in JavaScript is straightforward as long as you get the day, month and year separately in the first place. This function not only performs the validation, it loads the date into a date object for you as well.

Wednesday, October 10th, 2012

Keeping Entered Values when Reporting an Error

Sometimes the solution to a problem is extremely simple but not very obvious until you know what it is. One such simple solution relates to not losing the values already entered into a form when you want JavaScript to report validation errors. Keeping Entered Values when Reporting an Error p.s. why do so many people [...]

Tuesday, September 11th, 2012

Form Submission and Ajax

In this article we look at the circumstances under which it makes sense to apply JavaScript validation to individual form fields and where it makes sense to apply the same validation immediately before submitting the form. Validations that involve calls to the server (called ‘ajax’) are a special case. Form Submission and Ajax

Tuesday, August 7th, 2012

JavaScript Email Address Validation

The only way to really know if an email address exists is to send an email to the address and then get a response back. Validating email addresses even to determine if a given address is allowed to exist is quite complex. Most scripts that people use to validate email addresses actually reject a large [...]

Tuesday, May 29th, 2012

The Importance of Validation

Leaving out the validation makes it easier to demonstrate the part of the code that is being taught without it adversely affecting the way the code works provided that only valid values are input. Since the person learning to code can be relied on to enter valid values this makes teaching the code constructs easier [...]

Tuesday, May 15th, 2012

Proper Processing of Variables in PHP

Just about all of the forum questions asked by PH beginners have no input processing in their script whatsoever. With over half the code that they should have in the script missing, that the part they do have doesn’t quite work properly is the least of their problems. One way of making sure all of [...]

Saturday, March 17th, 2012

Invalid HTML

Why worry about validating your HTML? Well there are a number of reasons why it is best to avoid using HTML that doesn’t validate. Invalid HTML

Wednesday, October 26th, 2011

Validating Radio Buttons

I first wrote this page back in 2001 and for most of the time since then it has been the number one result in Google for that phrase. Of course JavaScript has changed a lot since then and so I have written other versions of the page showing the alternative ways to do it (which [...]