• Topic
  • Discussion
  • OATWikiWeb.OATDOCvalidation(Last) -- Owiki? , 2016-08-19 14:58:53 Edit owiki 2016-08-19 14:58:53

    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 '___'
    

    Referenced by...