Index | OAT homepage | OpenLink Software

# OATDOCvalidation

- OATDOCvalidation
- _ _ validation.js
- _ _ _ _ Functions
- _ _ _ _ _ _ OAT.Validation.create(element, type, options)
- _ _ _ _ Constants
- _ _ _ _ _ _ OAT.Validation.TYPE_
- _ _ _ _ Example

## validation.js

Creates restricted input controls.

### Functions

#### OAT.Validation.create(element, type, options)

Restricts input `element` . Restriction `type` is an `OAT.Validation.TYPE_` constant. `Options` may consist of:

- `min` - minimum number of chars (for `OAT.Validation.TYPE_NUMERIC` and `OAT.Validation.TYPE_LETTERS` ) (default `0` )
- `max` - maximum number of chars (for `OAT.Validation.TYPE_NUMERIC` and `OAT.Validation.TYPE_LETTERS` ) (default `50` )
- `def` - default character (for `OAT.Validation.TYPE_NUMERIC` and `OAT.Validation.TYPE_LETTERS` ) (default `"_"` )
- `defDate` - default date (default `[today.getFullYear(),today.getMonth()+1,today.getDate()]` )
- `minDate` - minimum allowed date (for `OAT.Validation.TYPE_DATE` ), in form of `[year, month, day]` , all indexed from 1 (default `[1900,1,1]` )
- `maxDate` - maximum allowed date (for `OAT.Validation.TYPE_DATE` ), in form of `[year, month, day]` , all indexed from 1 (default `[2010,12,31]` )
- `regexp` - regular expression (default `""` )

### Constants

#### OAT.Validation.TYPE_

- `OAT.Validation.TYPE_NUMERIC`
  - ToBeDone
- `OAT.Validation.TYPE_LETTERS`
  - ToBeDone
- `OAT.Validation.TYPE_DATE`
  - ToBeDone
- `OAT.Validation.TYPE_REGEXP`
  - ToBeDone

### Example

    var i = OAT.Dom.create("input");
    OAT.Validation.create(i, OAT.Validation.TYPE_LETTERS,   // 3-10 chars,
                          {min:3, max:10, def:"_"});        // default '___'

Copyright (C) 2005-2008 OpenLink Software