Faibbus works with an international team. Some of his fellow developers don’t quite adhere to the same standards. This code was in a module, and the comments and text were originally in Dutch.


   //because the greater/smaller signs are being escaped  

   if(this.value.length==1){alert('The year must have 4 digits.');this.focus();}

   if(this.value.length==2){alert('The year must have 4 digits.');this.focus();}

   if(this.value.length==3){alert('The year must have 4 digits.');this.focus();}


The Long Now Foundation doesn’t appreciate his date conventions.

Dates aren’t the only thing we need to validate. Adam stumbled across this attempt to validate an input:

function checkKey( String key ) {
 try {
    Integer.valueOf( key );
 } catch ( NumberFormatException e ) {
 throw new CodeUnreachableException( "Keys may not be purely numeric: " + key );

They really don’t want you to enter a number here. This approach to doing validation is… exceptional .

Sometimes, when we’re validating input, we like to provide feedback to the users by doing things with colors, like changing the background color. This line, found by Wilson, does the job.

if (!(!(i == detailsList.length() - 1) || detailsList.length() < 3))
[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!