Validations

From AardRock Wiki
Revision as of 13:09, 2 May 2006 by Chris (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

We need to validate user-input. One idea is to do it the Rails-way, that way, or model might look something like this:


class User {
   public boolean validate() {
      validatePresenceOf("name"); // a name is mandatory
      validateFormatOf("date", "\d\d\-\d\d\-\d\d\d\d"); // a date must follow this format
   }
}