Docs
API
-
Config
- barHeight
-
bbar
- bbarHeight
-
buttons
- buttonsHeight
- cls
- defaults
- draggable
-
events
-
footer
- height
- id
- i18n
-
items
- column
-
data
- defaults
- disabled
- displayKey
- editable
- emptyText
- events
-
format
- itemCheckBox
- inputHeight
- inputLabel
- inputWidth
- label
- labelAlign
- labelWidth
- listItemTpl
- leftTpl
- leftWidth
- max
- min
- minListWidth
- multiSelect
- multiToggle
- name
- showPassTip
- spin
- step
- subSearch
- tabIndex
- tip
- type
- value
- valueKey
- vtype
- width
-
lang
-
date
- method
- modal
- params
- renderOuter
- renderTo
- scrollable
- shadow
-
subTitle
-
subTBar
- allowToggle
- action
- cls
- data
- disabled
- displayKey
- editable
- emptyText
- enableToggle
- events
- format
- handler
- hidden
- id
- imageCls
- inputHeight
- itemCheckBox
- leftTpl
- leftWidth
- max
- menu
- minListWidth
- multiSelect
- multiToggle
- paramsMenu
- paramsText
- pressed
- spin
- step
- subSearch
- text
- tip
- toggleGroup
- type
- valueKey
- vtype
- width
- subTBarHeight
-
tbar
- allowToggle
- action
- cls
- data
- disabled
- displayKey
- editable
- emptyText
- enableToggle
- events
- format
- handler
- hidden
- id
- imageCls
- inputHeight
- itemCheckBox
- leftTpl
- leftWidth
- max
- menu
- minListWidth
- multiSelect
- multiToggle
- paramsMenu
- paramsText
- pressed
- spin
- step
- subSearch
- text
- tip
- toggleGroup
- type
- valueKey
- vtype
- width
- tbarHeight
-
title
vtype
Mixed
Validation type.
There several built-in validation types and possible to do self.
Built-in types:
'email', 'range', 'min', 'max', 'notnan', 'notempty'
Some types can be used as string value, another requires additional params.
Examples
Email vtype
Range vtype},{ vtype: 'email' },{
Min vtype},{ type: 'number', vtype: { before: ['notempty', 'notnan'], type: 'range', min: 20, max: 70 } }]
Max vtype},{ type: 'number', vtype: { before: ['notempty', 'notnan'], type: 'min', param: 30 } }]
NotNaN vtype},{ name: 'age', label: 'Age', type: 'number', vtype: { before: ['notempty', 'notnan'], type: 'max', param: 70 } }]
},{ type: 'string', vtype: 'notnan' }]
To do self
vtype
it needs to useFancy.addValid
There are 2 approaches on checking validation: over RegExp and over function.
Function
Fancy.addValid('notnan', { text: 'Must be numeric', fn: function(value){ return !isNaN(value); } });
RegExp
Fancy.addValid('email', { re: /^(")?(?:[^\."])(?:(?:[\.])?(?:[\w\-!#$%&'*+\/=?\^_`{|}~]))*\1@(\w[\-\w]*\.){1,5}([A-Za-z]){2,6}$/, text: 'Is not a valid email address' });
Params
To use params inside of function, it requires to define them.
They will be avaliable inside of function over
this
Fancy.addValid('range', { before: ['notempty', 'notnan'], text: 'Must be between {min} and {max}', fn: function(value){ return value >= this.min && value <= this.max; } }); ... items: [{ type: 'number', vtype: { before: ['notempty', 'notnan'], type: 'range', min: 20, max: 70 }
To do complex validation, it requires to add property
before
with list of queue of vtypes.},{ type: 'number', vtype: { before: ['notempty', 'notnan'], type: 'max', param: 70 } }]
Default
undefined
-
date