jQuery.fn.glowPatternedTextBox
Decorates a text input with patterned input functionality
Usage
$('SELECTOR').glowPatternedTextBox(options)
where 'SELECTOR' contains the text input element(s) which will be patterned and the options object can contain:
Options
-
pattern
: The pattern to use for the text box. Two types of pattern definitions are supported (any text between a pattern definition is considered static and uneditable):- Numeric range pattern: <X-Y> where X and Y are numbers. Any value between X and Y (inclusive) is considered valid. If either X or Y includes decimal places, the greatest number of decimal places will be used.
- Selection range pattern: <Value1,Value2,Value3,Value4,Value5> where any defined textual value is considered valid.
-
Examples:
- Date:
<Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec> <1-31>, <1900-3000>
- Time:
<1-12>:<00-59> <AM,PM>
- Unit:
<0-1600> <px,pt,%,pc,in,mm,cm,em,ex>
- Decimal Unit:
<0.00-100.00> <px,pt,%,pc,in,mm,cm,em,ex>
- Short-hand Date:
<01-12>/<01-31>/<1900-3000>
- Date:
- default:
empty string
-
allowBlanks
: whether to allow blank entries- default:
true
- default:
-
blankCharacter
: pattern character which represents blanks- default:
-
- default:
-
onValidation
: callback function which can provide custom logic for handling the input of a patterned text box. called whenever a segment of the pattern is iterated up or down. callback returns an array of selected indexes corresponding to each region in the patterned text box. callback is passed:- jQ - the patternedTextBox instance jQuery selection
- regions - string array of current regions
- type - 'next' or 'previous' string - the direction of selection
- modifiedIndex - current index of regions being iterated
Events
glowPatternedTextBoxChange
- triggered when the text box changes value
Methods
getPatternValues
Returns a string array of the selected pattern values
var patternValues = $('SELECTOR').glowPatternedTextBox('getPatternValues')
getPatternValueOptionIndex
Returns the index of a given pattern value within a given pattern identified by its pattern index
var patternIndex = 2;
var value = 'vale';
var valueIndex = $('SELECTOR').glowPatternedTextBox('getPatternValueOptionIndex', patternIndex, value)
getPatternValueOption
Returns the value of a given pattern index within a given pattern identified by its pattern index
var patternIndex = 2;
var valueIndex = 3;
var valueOption = $('SELECTOR').glowPatternedTextBox('getPatternValueOptionIndex', patternIndex, valueIndex);
setPatternValues
Applies selected pattern indices to each pattern
var patternValues = [4,3,9];
$('SELECTOR').glowPatternedTextBox('setPatternValues', patternValues);
val
Gets and/or sets the current value of the patterned text box
var value = $('SELECTOR').glowPatternedTextBox('val');
$('SELECTOR').glowPatternedTextBox('val', newValue);
disabled
Gets and/or sets whether the current patterned text box is disabled
var disabled = $('SELECTOR').glowPatternedTextBox('disabled');
$('SELECTOR').glowPatternedTextBox('disabled', true);