logo

Validation Revisited, Again

My current engagement involves quite a bit of form validation. Before I started I wanted to find a novel approach to this common requirement. Coincidentally this was about the same time that Andrew Tetlaw wrote his Really easy field validation with Prototype article, which has not only been featured on Ajaxian but made it to the Digg.com front page.

I'd have congratulated Andrew on being the first Domino blogger to get "dugg" if it weren't for the fact he says it's not a Domino blog. Although he's a Domino developer and regular codestore visitor he's adamant his site isn't about Domino.

Anyway, I liked the way he was doing validation and, assuming it would work with Domino, had a go at plugging it in to my forms. Finding it didn't work I mailed him to find out if he knew why (lazy me!). With his help I soon got it working with a Domino Form. Only then to find it doesn't work with anything other than text fields (something he's working on). That's when I decided to take inspiration from his techniques and have a go myself.

Remember my Form Validator code? (demo). It's over five year old now! Time for a rethink perhaps. So, using Andrew's approach for error reporting I plan on re-writing this code. Give me a couple of days and I should have something for you to download.

Comments

  1. Hi

    You can use Dojo Toolkit for validation. {Link}

    This library contains some useful functions for form validation. On my site exist an article about form validation using dojo toolkit which is written in russian language. {Link} Shortly, dojo toolkit contains dojo.validate module. That module contains dojo.validate.check function for entire form validation. That function has 2 parameters:profile for form validation and form object. profile is JSON object. it works well in domino web applications. if you want i can sent you a sample.

  2. All very nice for the user experience, but it goes no where to stopping the idiots/hackers.

    You still must have validation on the submitted form and not rely on the JavaScript to catch it. Knowledgable users can still submit stuff through unchecked. Unless you catch this server-side you could open yourself up for a whole slew of problems.

    For example, United Publications {Link} gets loads of attempts at credit card theft. Attempts at Spam sending, fake information, the whole caboodle. If everything was accepted as it is submitted to the database, there'd be serious trouble.

    Whilst this sort of thing looks good to the user and gives them a good nudge when they forget to enter vital info, the simple matter is you cannot get away from proper server-side validation. It's a pain. But one which must be done otherwise you can never trust your data again.

    • avatar
    • Jake
    • Tue 23 May 2006 06:39 AM

    Agreed Dragon. If only Domino allowed better control of user sessions and made it easier to validate server-side. This is something I've talked about at length in the past and never found a real solution to. Save for saving all and any documents, including on them a "validated" flag field that tells a nightly agent whether to delete them.

  3. I liked this method of doing validation, although it is missing a couple of things. Besides being able to handle multiple types of fields, there is no way to do conditional validation. Like if you have a yes/no question and, if the answer is no, you need to enter an explaination. So many of the forms I create need this type of functionality.

    Sean---

    • avatar
    • Jake
    • Tue 23 May 2006 10:18 AM

    Sean. Look at the demo I posted today. If Customer Type=Developer in that form then the field after it is required.

  4. Hello Jake,

    I was very happy using your Form Validation version 2.0. modular in the past. I greatly appreciate if you can send me the template for this revised version 3.0.

    Best,

    Myle

  5. Hi Jake,

    Please forgive me for asking you to send me the .nsf file. I should download the .nsf file directly from your site.

    Lots of great enhancements to the database and the cool way to validate at the end.

    Great job!!!

    Thanks for your brilliant and hard work!

    Myle

Your Comments

Name:
E-mail:
(optional)
Website:
(optional)
Comment:


About This Page

Written by Jake Howlett on Mon 22 May 2006

Share This Page

# ( ) '

Comments

The most recent comments added:

Skip to the comments or add your own.

You can subscribe to an individual RSS feed of comments on this entry.

Let's Get Social


About This Website

CodeStore is all about web development. Concentrating on Lotus Domino, ASP.NET, Flex, SharePoint and all things internet.

Your host is Jake Howlett who runs his own web development company called Rockall Design and is always on the lookout for new and interesting work to do.

You can find me on Twitter and on Linked In.

Read more about this site »

More Content