2008 in Retrospect

If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!

In this post I will list a couple of things I think was interesting, significant or the bomb during 2008. In no way is this list full and I probably missed something such as the birth of a new internet empire or something, but the things listed below is stuff I remember and find interesting about 2008 and believe will make the biggest effect on the years to come.

Mobile Web

iPhone and the Android platform have changed the way people interact and expects of web based services the last year. We wrote a post about how iPhone and Android will change the web earlier this year and with Firefox as mobile browser coming up, we know that 2008 was the year mobile web, finally after a lot of years, made it to the crowd and online services.

Mature JavaScript Libraries

2008 saw no or very small happenings in the JavaScript library world. We saw a lot of great implementations on top of the big libraries but nothing revolutionary. The big things coming as I see it are jQuery 1.3, YUI 3 and hopefully someone who dares to take the libraries to a new abstraction level without bloating the experience of using the framework/library. One framework that have been good at promoting its name the last year is Dojo. I believe 2009 can be interesting when it comes to JavaScript as developers who traditionally only developed back-end solutions will move over to write more front-end solutions as the online libraries, services and tools are growing in numbers.

CSS Frameworks

No one likes CSS. Except the guys and girls who distribute and maintain CSS frameworks. One really good thing with 2008 was that we saw that CSS frameworks such as BlueprintCSS, YUI, YAML, Boilerplate and 960 grew in numbers and more people started using them. The higher abstraction level the easier to focus on the right things instead of things such as browser bugs etc. What are the next step? I believe we will see more interaction pattern based components that combine CSS, JavaScript and Markup and solves problem under the hood, graceful degraded, unobtrusive, SEO-friendly and better than you as a single developer can build them.

Bubblish

2008 was the year we saw strange services pop up each and every day, and you asked your self the question: “OK, I know the Internets are big and that, but who wants a micro-blogging-video-on-demand-service for chihuahuas?”. Together with the financial crisis and venture capitalists that start to think one more time before throwing money at someone faster than they can say “twitterish” we have moved into something that looks more and more like the dotcom-bubble 2000-2001. The big difference now compared to then is that now we actually have websites who earn money, and hopefully some people will still have a job to go to in late 2009.

Platforms and Tools

Not all platforms and APIs was released 2008, but this was the year we actually started using the platforms, tools and APIs out there. LinkedIn, MySpace, Facebook, Yahoo, Twitter and Google all opened up new ways to retrieve and manipulate data as third party developers. In 2009 we will laugh at services who do not expose a platform or API. It will look as stupid as not having a mobile front-end.

Google App Engine

Google launched Google App Engine in April 2008 and the main thing with it was the possibility to host and run you web application in the big Google Cloud. This opens up for the developer to easily build big scalable web apps. I believe we will see more of this in 2009.

Google Chrome

The Google Chrome Strategy is interesting and not fully understood yet, but years of discussion about the Gbrowser and Google pushing for Firefox ended in Google releasing Chrome. Chrome is not available for Mac and Linux yet, but built on WebKit and with an extremely fast JavaScript engine (V8) it will probably start gaining market share anyway. My personal opinion is that we do not need another browser, I would rather have seen Google going full time into either Firefox or WebKit rather than starting their own branch. In the long run we do not need more browsers.

Authentication Services

Facebook Connect, Friend Connect from Google and OpenID saw their big debut and usage in 2008. Even though OpenID been available for a while, it was just now we saw big use of such services. With 1,000,000 different social networks and other sites where you need to store credentials, the need for such services will only grow stronger over the years to come.

Twitter and FriendFeed

For micro-blogging sites such as Twitter and real mashups, such as FriendFeed, 2008 was the bomb. According to services such as Compete.com these services has grown significant during 2008 and nothing seems to stop them during 2009 (maybe the uptime for Twitter though ;-)). Barack Obama used Twitter (even though I doubt he did it in person) as one important piece of his winning election campaing that sent him to the white house.

Personal Level

  • My then-wife-to-be gave birth to our second child in May
  • We finally got married in December
  • I turned down a really (really, really, amazingly) good job offer
  • I was about to build a great new house

Conclusion

2008 was an interesting year with ups and downs, both private and professional. I believe that 2008 finally showed us the web as a web of services where small dedicated services prosper over the ones trying to be a one-stop-shop for anything. The internet is more and more becoming a distributed UNIX-system with specific services doing the thing it does best, and it is up to the user (another service or a person) to do whatever he/she/it needs the system for achieving.

Happy New Year,
Mattias


WP-JSON - JSON Syndication for your WordPress Blog

I have just finished a very simple plugin that enables JSON-syndication for blogs running on WordPress. You can test the output on this blog.

http://frontendbook.com/feed/json/?callback=? (content-type:application/json)

Find out more

Why

  • I think JSON is a very powerful way to syndicate content and data
  • I think we should not need to write stupid proxies for aggregating feeds via JavaScript
  • Opening up your data is a good thing
  • I could not find a working example that was a plugin, all solutions I found was hacks in the actual source code of WordPress.

jQuery Example Retrieving JSON


$(function(){
$("body").append('<div id="wp-json">Loading JSON</div>');
$("#wp-json").css({
'position' : 'fixed',
'right' : '0px',
'top' : '0px',
'background' : '#f00'
});
$.getJSON('http://frontendbook.com/feed/json/?callback=?', function(json){
var result = '<ul>';
$.each(json.items, function(){
result += '<li><a href="' + this.link \
+ '">' + this.title + '</a></li>';

})
result += '</ul>';
$("#wp-json").css({
'background' : '#fff'
}).html(result);
});
});

Download


Recession Reality Check for Web Developers

Ok, Yahoo is laying off people in big numbers, and every day we hear about the health of the world economy. I think it is clear to everyone, this is more than a sneeze, it is recession hitting us hard and fast all over the world. Of course this will become reality even for people working in healthy businesses, in comparision to Yahoo, where there are a business strategy, product focus and numbers going in the right direction. How do you adapt to the fact that things are actually going the wrong way, and things out of your hands may eventually decide wether or not you have a work to go to next month. People who were part of the dotcom-crisis know that even healthy companies got hit harder than they deserved. In this post I will try to discuss how you can handle recession and prepare for the worst and make all you can in order to avoid it.

Pragmatic, Pragmatic, Pragmatic

OK, now is the time to start being pragmatic when it comes to everything. Roles, tasks, platforms, frameworks, libraries or any other thing that could enable cat-fights in any web department. Ask yourself the question: “Am I a pragmatic person when at work?”. If the answer is Yes, could you be even more pragmatic in even more areas, in order to avoid unecessary (from a business point-of-view) discussions and fights. If your answer is No, start being more pragmatic, put feelings and opinions away and focus on facts, reality and truth. I know a lot of people who say they are pragmatic (everybody wants to be pragmatic) and at the same time say that we must spend 12 man-year on building an almighty architecture that will survive WW III, when business needs here and now could be solved with existing tools or with lesser efforts added to the project. In short: Start being pragmatic in your daily work, and stop saying you are pragmatic.

Focus on Possibilities

Recession opens up for good things. When times are bad, investors and competitors decrease their efforts and that is a possibility. When others are braking, you should increase your efforts in order to gain market shares or enter a market that are ultra-competitive during good times. As long as you are still employed or running your own business getting clients, make sure you invest whatever you can invest making sure that you are increasing your market shares and revenues. This sound easier than it is in real life. But in order to convince you: Apple, Microsoft and businesses such as Online Poker where born during other time of crisis. I am confident we will see new business-leaders born or growing big during the coming years. I am writing a post on what companies I think will go out of recession as winners, will publish it before Christmas. Remember: In bad times, brave people can build the platform for being the next winner.

It Aint Personal

If for some reason someone (your company or lack of clients) puts you in the corner where your job is at risk, or even worse you get sacked or have to shut down business, Do not take it personally, because during times like these even talented people are fired. Often middle-management has to fulfill a number of layoffs and meet some strange budget-requirement making their decisions somewhat numeric instead of human-resource-optimized. Often roles needed for running daily businesses are the ones that are prioritized to keep. If you do not do this right now, you are probably more likely to get sacked than the guy making sure that the SVN-server is up and running. But it aint personal (most of the time at least).

Business Argument not Techie Arguments

I do not like techie arguments when we have good times, and I am pretty sure no business owner likes them at all during bad times. Developers have to be better, in good and bad times, trying to put numbers on their arguments. This is important for two reasons: First, it is easier to convince the business owners with business arguments and second, if developers try to find business arguments instead of tech arguments, they will be better developers as they do understand business better and tech solutions are business driven and not vice verca.

Summary

We will face recession. Your company will adapt to this. Maybe they speed up, maybe they slow down. The important thing to know is that no one is safe but recession is not all bad, it also opens up for new businesses and possibility to enter competitive markets. One good thing to bear in mind during recession, as well as better times, is to try to be more pragmatic and business oriented not only in mind but also in action.


3 Ways To Use Twitter - spamming is not one of them

How do you use Twitter?

I am increasing my use of Twitter. I have been trying to figure out whether or not I like Twitter as a daily tool, and I am leaning towards a positive answer. As I see it there are numerous of ways you could use Twitter, and I am sure I have only started with the most basic functionality (tweeting my thoughts, posts and whereabouts). In this post I will try to discuss and figure out different ways you could use Twitter.

Make sure you do not miss something

When I wake up every morning, before I hit the shower, I make sure I check teletext so I do not miss out on anything important. It would be pretty embarassing coming to work and everybody are talking about planes flying into buildings or other breaking news I easily could have managed to collect. For other people radio or morning tv serve the same purpose, but when you have small kids, morning tv is Bob the builder, Shaun the sheep and not CNN. I believe Twitter serve as my niche radio or niche teletext. As long as I follow the people in my niche, all over the world, I will surely not miss even the smallest news in my niche. As someone who is looking forward to learn more, get the news when it happens and have input for blog posts, I really appreciate this part of how to use Twitter. Of course tools such as Thwirl and Twitterific helps you on achieving this.

Promoting Your Stuff

This is a tricky part. I have seen people mixing it up pretty good, not only spamming Twitter with links back to their blogs, but also managing to actually do 140 character analysis worth reading on their own. I think this is something you should gradually manage to find a strategy for, that suits you and the ones following you. It all boils down to personal branding, do you wanna be considered a spammer or someone who adds value to other peoples tweet-list. I have actully unsubscribed to a lot of people I had higher beliefs in before I started following them. Twitter is such a powerful tool, as soon as you say something it is availble on all your followers dashboard, that forces us to have some kind of plan on how we would like other to look at us. My strategy is to always promote my blog posts, because I believe that the people who have choosed to follow me may also be interested in reading my blog posts. On top of that I try to post link to resources I find valuable. In order to promote your stuff, I think it is important that you also add value to the network through interaction and actually respond to the people who you follow or are followed by.

Feeding Content into other systems

Twitter exposes all content via API:s, this makes sure you can build applications posting to Twitter, and applications reading from Twitter. We have seen a lot of applications for updating Twitter and some applications for searching Twitter (before Twitter had search). I believe that the next step is to use Twitter as a tool for updating external system, such as posting content other social networks (yes we see that today on FriendFeed), but actually being able to trigger specific actions on the other system. Because lets be honest: Twitter is only a tool for updating with short texts, we have only started to playing with the possibilities on what we can do with such tools. 140 characters are short for stories, but long enough for sending actions, events, triggers and commands to other systems. I believe that we will start to see more system accounts on Twitter where followers can run system commands by “replying” to the system account (@system Location:New York, Group:user1,user2,user3). Maybe I am way out here, but the tools we could build are amazingly interesting. Using Twitter like this is to see Twitter as a part of your application architecture. The benefits you get is that the tool is widely spread, easy to use and have a lot of API:s.

Conclusion and Analysis

Twitter has gained an enormous amount of users in a short time, as always, the geeks where there first, and a lot of people think it is a geek thing, but, I am sure that tweeting will, as blogging has, move from the geeks to ordinary sane people with bigger interests than programming and internet. When that happens, we will see an explosion of different ways to use Twitter, or twitter-clones, enabling new features for spreading whatever users are interested to spread quickly to a wide network of connected followers. The big questions are How do you use Twitter and How do you think Twitter will evolve?


Web Standards vs. Reality

Some people in the web development/web design/front-end development industry would rather be caught on tape stealing food from small children than admit they pollute the web with websites that do not meet standards when it comes to markup, stylesheet and javascript.

I break these standards on a regular basis, and apparently a lot of other people do as well, according to Opera, only 1 in 25 adhere to web standards, and the rest breaks them in some way. Why is that? Are standards not worth following? My answer is: it depends on the context.

In this post, I will not discuss things such as page size, design from content separation, behaviour from design separation, search engine optimization etc etc, as I believe that all of these can be achieved just as good not adhering to web standards, and that the areas have been dicussed for 5+ years. I would like to focus on things that not so many people talk about when discussing standards; How it affects revenues and the actual organization running a website.

The Business Perspective

Building a new Website / Redesigning a existing one
If you are building a new website, there are few reasons not following standards for css, script and markup. From a technical point of view, there are probably no arguments that are valid for not adhering to standards, but from business point-of-view, there may be some arguments that are valid. These arguments may be:

- Legacy non-standard CMS Software enabling quick time-to-market
- More time efficient development given the teams core comptence
- Alternative Cost, how much do we gain (in money, short and long term) from adhering to standards comparing to not have it as a business requirement.

Running an existing non-standards compliant website

This is where reality hit hard on standard advocates. Converting an existing non-standard-compliant website to a standard-compliant website can be a really daunting job. But it all boils down to technical solutions and a lot of hard work. The real problem is to find the argument, money-wise, to do it. As a businessowner you must ask your self the question: “Why should we use X nr of resources for moving to standards, when we could use the same resources for making our product better?” This is where people who thinks standards are a matter of life and death have to sharpen their arguments. Below I have listed different aspects of a websites function and lifecycle where it is important to understand the conflict between reality and standards.

The Knowledge Perspective

Not all websites are built by people who are educated in web standards. I think that a very common problem with web standards, are the fact that a lot of web-frontends are built by someone who knows their standards and run and maintained by people who do not care or have the knowledge needed to adhere to the standards that the site should support. The big question is again money. How much do we gain, educating people in standards compared to keep the speed up with the current knowledge?

The Web as API Perspective

This is where standards becomes important, in order to expose your web as an API, enabling mashups, this could be done using micro-formats, your own XHTML-schemes or just letting external users grab your content easily and mash it up on their side. Of course a valid XHTML-page will be easier to parse and load as an API, but on the other hand, screenreaders, search engines and other page parsers have been able to grab info even from non-standard supporting websites for a long time, there are even numerous of libraries that lets you do just that. When it comes to the web as API, I believe it is important to focus more on building a website that is API-ified when it comes to url-structure and parameters for responseTypes and locales etc. From this perspective, adhering to standards is of course important, but not adhering to standards is not the same as not being able to expose your web as an API. The only thing you do if you run a website that do not follow standards is making it a tad more difficult for your integrators to mashup your website.

The Accessability Perspective

Accessability and Usability, how do they relate to web standards? There is one argument that everyone is talking about all the time, screen readers. OK, this is close to the above argument. My belief when it comes to this is that a screenreader that can not read non-standard pages, will not be a big success, since a lot of websites, as stated above, do not adhere to standards. Of course a semantic web is easier to understand by machines, and will increase accessability and findability enabling better SEO. As the machines reading the web will become more sophisticated, issues like this is probably a smaller issue in the future, than it is now

The Maintenance Perspective

Some people say that standard based front-ends are easier to maintain. From one perspective I am obliged to agree, web standards fronts are more often separated semantically, css doing design, script behaviour and markup for content. But the separation has nothing to do with standards. One argument could be that if we use standards we do not have to maintain “hacks” in css, script and markup, but as long as you are using components and frameworks you should not have to worry about these things. If everything is a mess with no separation and no standards followed, there may be reasons to change this, if we can find a business argument for it: The cost for moving the web to standards and separation of markup, design and behaviour must be lower than the gains from maintaining a standards compliant product compared to the old solution.

The Code Quality Perspective

Another argument is that standards are better from a quality perspective, that is just noncence. You can build crap with cheap and expensive tools, as well as you can build crap websites with standards and non-standards. You can even build great websites with non-standard solutions.

Conclusion

Standards serve a purpose, they get developers to start thinking how they build things, and slowly they adapt to new patterns and processess building webpages, creating better semantics and separation of design, content and behaviour. Standards are good. But not following them is not the same as doing wrong. There are a number of arguments that may force us to build or keep maintaining products that do not follow standards, often the reason are economical. I believe that in order to be business-oriented all developers have to understand that sometimes the “best” technical solution is not good enough from a business perspective.

Resources

  • http://dev.opera.com/articles/view/mama-markup-validation-report/
  • http://www.sitepoint.com/blogs/2008/10/17/opera-just-413-of-webs-code-is-valid
  • http://dev.opera.com/articles/view/mama/
  • http://dev.opera.com/articles/view/mama-key-findings/
  • http://dev.opera.com/articles/view/mama-the-url-set/


jQuery Support in Zend Framework 1.7

In Zend Framework 1.7 there will offer native jQuery UI support.

The link above offers good documenation on different potential use-cases for jQuery UI plugins as helpers and how they will be implemented in Zend Framework. There is also a link to some examples and some comments on how the implementation may look like. Interesting. I made a list 1,5 year ago on why jQuery will win the race as the standard JavaScript library and it looks like number 9 in that list is the thing that will make sure that John and jQuery sets the standards for how You are going to work with JavaScript solutions in the future.

There are more interesting things in the 1.7 Preview Release, though not feature complete. See list below and download the Preview Release from http://framework.zend.com/download/latest

While 1.7PR is not a feature complete release in the 1.7 series, it
nevertheless contains some very important features scheduled for the 1.7
production release:

* New Zend_AMF component
* Dojo Toolkit 1.2.0
* New ZendX_JQuery component
* Support for dijit editor
* Metadata API in Zend_Cache
* Google book search API
* Performance enhancements
* Application-wide locale with other i18n enhancements
* File upload form element enhancements


Building the Perfect WordPress Theme

I am looking for a Wordpress theme for this blog. The problem with 90% of all themes available is that they focus only on design, not so much on all the other aspects you have to take care of when running a blog/website. Instead of just complaining, I decided to try to define what I believe is needed in order for a Wordpress theme to be professional and worth installing and maybe even buying (Who the hell pays for themes with just a slick design and no functionality added to it?). Now you may ask me why I write this article instead of creating a theme that fits my purpose? Maybe I will, if I find the time, for now you have to stick with me ranting on about why we need better themes for Wordpress.

Admin section

One of the most important things in order to offer a professional wordpress theme, is to create an admin interface, enabling the publisher to manage functionality, look and feel and performance settings. Ideally in this section you could drag-and-drop containers for different types of templates and setup thing such as areas for widgets. Build page templates, edit headers, footers, navigations etc etc. The theme should also implement some kind of frontend cache on top of WP Cache in order to keep database connectivity to a minimum for widgets and template data.

Integrated functionality out-of-the-box

No one thinks it is great fun to enable 25 different plugins and set them up, whenever they are installing a new Wordpress instance. Why not integrate functionality for the most popular plugins into the theme, and make that functionality managable from the admin interface.

Designed with ad standards in mind

Whether you like it or not, a lot of people will show ads in some sort on their blogs/websites whenever they start to get visitors to their site. The theme should make this easier by adapting to standard for ads.  Ad Unit Guidelines at IAB.

Allow functionality for integrating with 3rd party data providers

A lot of people will use their WordPress installation as a Web Content Management System and there are few sites out there that do not provide dynamic product data or other data provided by a 3rd party data source.

Navigation solution that can handle both wide and deep structures

In order to be able to manage larger websites, the theme should offer either very flexible templates for pages or several templates to choose from in order to achieve different types of navigation depending on depth in site. 

i18n and l10n enabled

Not all websites are written in english for an american market. Some sites even target multiple markets. A professional theme should take care of this with translations enabled and the possibility to show specific content for specific locations/markets. 

No need for editing files

There should be no hardcoded values in a professional and useful theme. There should be no need at all to change anything in any file distributed, this should be taken care of by adding admin user interfaces for things that can be changed/modified/edited.

Object Oriented MVC approach to coding

In order to make it possible to extend the functionality of the theme it is good programming practice to strive for object oriented code even when programming themes for WordPress. 

Make use of only standard libraries for CSS and JavaScript

A big problem when it comes to frontends is the compability problem with the browser clients that will request your sites. By using standard libraries such as BluePrint CSS and jQuery you will make sure that you are building your frontend code on foundation that will work on a large number of clients. And I guarantee, no matter how good you are at JavaScript or CSS, you will not create as good code and you will not test it as thouroughly as those libraries have been tested.

Delivered with variations available

What it all boils down to is the look and feel and people have different opinions about this and in order to increase the spreading of your new professional theme, you should add variations in look and feel for your theme, or themes within the theme if you like. 

Conclusion

Today 99% of all themes are just designed simple xhtml/css/javascript themes with no extra attached for those who see and use WordPress as Web Content Management System. There are even people charging for this kind of themes (AND PEOPLE BUYING). What will happen now is that publishers will have higher expectations and requirements for the themes they are using on their websites. A lot of the things I have discussed in this article is somewhat difficult to add to a theme without rewriting already exisiting functionality. I see two ways this will go, first you will see 10+ A-grade open source themes that will take a big part of the market as they start to implement a lot of the features I discussed (and features I have not even thought about of course). The next step after that is of course new software bundles where WordPress is just the base and we have a lot of CMS-functionality on top of WordPress. There are a lot of different bundles now that are sold as “Universal Solutions” for Made for Adsense-sites and Spam-blogs, but I am sure that within a couple of months a large free software bundling WordPress will show its face to the public and become very popular quick. Whatever political or religious opinion you might have on WordPress, it is here to stay and will be the base in a lot of publishing systems not yet developed.

Wordpress is not just Blog Software, it is Web Content Management Software and should behave and used in such a way.


Bruce Springsteen, The River in Copenhagen - Off Topic

This is just amazing. Bruce Springsteen captured on film making a wonderful version of The River on the streets of Copenhagen in the end of the 80’s.

 


JavaScript Form Validation

JavaScript Form ValidationThis article is an introduction to how to create good form validation with javascript. I will briefly describe the interaction pattern of client side validation with javascript. Later I will focus on 10 actions that will make your form validation perfect.

The Design Pattern of Client Side Form Validation

Whenever a user needs to submit data to your application, there is a need in validating the users input.

Top 10 tips for JavaScript Form Validation

Use a form validation framework or a form validation library

I strongly recommend using some kind of JavaScript-library or framework when implementing your client side validation. On top of that it is important to use/implement a validation framework, this is because you will have bugs and issues with your client side validation, and a framework makes it easier addressing these bugs and issues. When we changed client side validation on a redesign of a larger site lately, we built the validation framework on top of the jquery javascript library. That architecture has made it easier addressing issues and bugs that do arise during development and maintenance of your forms.

Focus on solving the big validation problems

As soon as you start developing and implementing your validation, it is easy trying to address all potential validation that is needed for all types of input. My advice is to try to catch 75-85% of the potential user input errors in the front-end validation. Trying to catch all will lead to the following:

  • Bloated code, your framework will grow too large
  • More or less impossible to test client side validation as there are too many combinations of validation that can go wrong
  • Business rules will move to the front-end.(More on how to avoid this by using Ajax later)

To avoid this I think that creating a small validation framework that can do most of the validation is the way to go, and leave the specific things for the server (or create a plugin to your framework later) to validate.

Do Form Validation before form is submitted

The traditional JavaScript form validation pattern used since the 1995+ is to validate the form when the user hits the submit button, and whenever the script encounter a form item with some error in it, focus on that form item and prompt the user with an JavaScript-alert saying that something went wrong.Today, there is no need doing it that way.In your pursuit of creating the perfect front-end validation framework, you must add the possibility to validate controls on other events than just submitting. I see these potential events:

  • Whenever a controls value is changed
  • When a control is blurred
  • Periodically check if controls has changed
  • When a control that is connected to another control changes value
  • When a form is submitted
  • When a form is reset (if you for some reason finds it intelligent to have a reset-button on your form)

Use Ajax Form Validation for business data input

In order to validate business data you have three alternatives

  • Let the server take care of it
  • Add business logic to your front-end code
  • Let the front-end talk to the back-end through an Ajax-API

My suggestion is to go with the first or the last option, if you go with the last option there are a couple of things to keep in mind

  • Make sure your code is secure. Sometimes “smart” solutions like these, exposes business data to people with a little technical knowledge
  • Create a server-side API that has a defined set of methods with a defined set of parameters to be sent to it.
  • Create a client-side wrapper, wrapping the functionality exposed in the server-side API.
  • Only allow communication between the server-API and the client-side API-wrapper
  • Make your API-responseType configurable, sometimes you want to show the result as HTML, sometimes you want to manipulate the answer within your JavaScript code and sometimes you will use the response for more queries. I think that the API at least must be able to response with these types:
    • json
    • html
    • xml
    • script
    • text

Typical business data in my mind, are unique usernames and emails, age-validation rules, address verification etc etc

Do extensive testing of your javascript form validation

There is one thing worse than no validation: Validation that do not let correct data through.In order to avoid this, my finding is that coding is a smaller part then the actual testing of the validation framework. My tips is to create unit-tests for all your validation rules as a part of the validation framework, this way it is easy for you/your team to verify functionality whenever a change is needed to your framework

Rewrite input data to valid formats

Some input will come in different formats, dates for example. JavaScript Form Validation should address this problem by rewriting from known invalid formats to the valid format. An example can be:20070325 -> validation rewrite format -> 2007-03-25Because the user has not made an error, he/she has given the system a correct date, it is not his/her problem if the system doesnt use his/her format. The system should then be able to rewrite the known wrong format (20070325) to the system correct format (2007-03-25). Typical areas where reformatting can be used

  • Dates
  • Time
  • Phone numbers
  • Social Security numbers / Personal Numbers
  • Trim spaces
  • Remove/exchange invalid characters

Attach javascript form validation late in the design process

Semantic webs must be able to present forms that do validate and function without the attachment of behavior, which is the case when adding JavaScript Form Validation. Therefore I think it is important to make sure your use-cases is valid with or without the adding of client side validation. If you make sure this is valid, there will be small problems making sure the web is ready for mobile users and search engines.

Make the script i18n- and l10n-compatible

If your web is successful for an international public, the non-english-speaking audience is next. In order to achieve this it is important that even user generated error messages is localised and translated. Make sure your client side validation framework is prepared for translation and other localised parameters such as currencies, dates and time-formatting.

Add callback functions to validator framework

90 % of the time you want to use your validation framework as it was intended to be used, 10 % of the time you will be wishing that your framework would be more generic to achieve some specific interesting effect you have identified while working with your site and validation framework. In order to achieve this I think it is important to add the possibiltity to attach callback functions for your forms, letting the developer use your library in a way you couldnt dream of. The definition of a good library is when people using it creates stuff you as a creator of the library didnt think was possible.

Make your framework/library extensible

If you add working hours to a framework or a library, it is important that the architecture of the library/framework is open, and is extendable.

Resources


Contact

You are more than welcome to contact us if you would like to discuss anything regarding the blog.

About

Front-End Book is run and primarily written by Mattias Hising, an experienced Lead Developer from Uppsala, Sweden. I try to focus my efforts on Front-End related issues, as I find the problems to solve are more complex and interesting than the ones in traditional back-end development.

Twitter | GitHub | FriendFeed | LinkedIn | StumbleUpon | Facebook | Delicious