Validanguage API Reference

Namespace validanguage

Global validanguage object The validanguage library was written by DrLongGhost in 2008. See attached MIT_License.js and readme.txt for licensing and documentation. Visit http://www.drlongghost.com/validanguage.php for updates.
Defined in: validanguage_uncompressed.js.

Namespace Summary
Constructor Attributes Constructor Name and Description
 
The validanguage library was written by DrLongGhost in 2008.
Field Summary
Field Attributes Field Name and Description
<static>  
validanguage.useLibrary
Valid values are 'none', 'dojo', 'jquery', 'prototype', and 'scriptaculous'.
Method Summary
Method Attributes Method Name and Description
<static>  
validanguage.$(DomNode)
Omnipresent dollar function.
<static>  
validanguage.addEvent(Object, Event, Function)
Generic cross-browser addEvent() function.
<static>  
validanguage.addEventInit()
Reassigns the validanguage.addEvent function, if an external library is being used.
<static>  
validanguage.addOrCreateValidationWrapper(Form, eventType,, validationsCounter,)
This function wraps multiple validanguage.el.elemId.validations event handlers and transformations within a single wrapper to call all loaded validations/transformations and exit as soon as a validation returns false.
<static>  
validanguage.addValidation(elemId, eventTypes, validationNames)
This function is used to either load a new validation for a form field, or to reactivate a validation previously removed with the removeValidation() method.
<static>  
validanguage.ajax(url, callback)
Very simple AJAX function
<static>  
validanguage.ajaxInit()
Initializes validanguage.ajax as browser-specific
<static>  
validanguage.ajaxValidationWrapper(ID, Event)
This function is called by setInterval and is used to check whether or not all ajax callbacks for a form have returned.
<static>  
This function loads all the validanguage.toggle() rules which are defined for a form following document.onload()
<static>  
validanguage.concatCollection(obj1, obj2)
Combines 2 node lists into 1
<static>  
validanguage.contains(node, node)
Determines whether the passed domNode is contained within the passed parentNode.
<static>  
validanguage.empty(testVar, falseIsEmpty)
Emulates PHP's empty() function.
<static>  
validanguage.format(Pattern, String, Regular)
This is a preset transformation which is used to reformat text input to match a desired pattern
<static>  
validanguage.getAjaxLookupIndex(element, counter)
This function iterates thru the ajaxLookup array and returns the index number corresponding to the passed counter value
<static>  
validanguage.getCaretPos(obj)
Gets the current caret position on an object
<static>  
validanguage.getComments(el)
Fetches all comment nodes in the passed form node and returns them in a node list Doesnt work in konqueror, since konqueror strips all comments from the DOM
<static>  
validanguage.getDateTimeDefaultOptions(options, defaults)
Helper function used by validateDate() and validateTimestamp().
<static>  
validanguage.getElSetting(Name, ID)
This function checks for a given setting in increasing specificity within the validanguage.forms[formId].settings object, and within the passed validanguage.el objects
<static>  
validanguage.getFormId(Form)
This function returns the Id of the parent Form for an element
<static>  
validanguage.getFormSettings(id)
This function returns the validanguage.form[formId].setting object for the passed element ID
<static>  
validanguage.getSettingFromComment(Name, Full)
This function parses the passed comment to retrieve the indicated setting
<static>  
validanguage.hideError()
This function hides the div containing the validanguage error messages for failed validations
<static>  
validanguage.inArray(needle, haystack)
Determines whether the passed item is present in the array or object.
<static>  
validanguage.inheritIfDefined(settingsHaystack, settingsNeedles, settingsTarget, constrainType)
This function searches settingsHaystack for all variables defined in the settingsNeedles array, and if they are located, they are copied over to the settingsTarget
<static>  
validanguage.init()
Initialization function for validanguage.
<static>  
validanguage.insertAfter(nodeToAdd, referenceNode)
Function to insert 1 Node after another in the DOM.
<static>  
validanguage.isExpiredAjax(formFieldId, ajaxCounter)
This function examines the ajaxLookup array to determine whether or not the specified ajaxCounter pertains to the most recent ajax call for that form field.
<static>  
validanguage.loadCommentAPI(Dom, For)
This function parses all comments in the current document, looking for the comment-based API and converts any validanguage statements it finds into the element/json-based API for further processing.
<static>  
validanguage.loadElAPI((Optional))
This function parses the validanguage.el object to load all the form-element-specific validation settings which the end user has defined via the Object-based API
<static>  
validanguage.loadForm(form)
This function loads a form and its settings into the global validanguage object so it can receive validation criteria.
<static>  
validanguage.loadNewFields(containingElement)
This function loads all the validation rules specified within the passed element.
<static>  
validanguage.parseSubstring(startChar, endChar, subject)
This function searches the passed subject and returns an Array of strings which are delimited by the characters passed to the function in the first 2 arguments.
<static>  
validanguage.populate()
Main function to be called onload to load all the validations
<static>  
validanguage.remainingChars()
This transformation function updates a div or span with the total number of characters remaining, based on a comparison between the number of characters the user has typed and the defined minLength and maxLength values for the field.
<static>  
validanguage.removeAllValidations(Containing)
This function will remove all the validations for any form fields contained within the passed containing element.
<static>  
validanguage.removeForm(Which)
This function removes all references to a form and its elements from the global validanguage object
<static>  
validanguage.removeValidation(elemId, eventTypes, validationNames)
This function is used to deactivate a previously loaded validation.
<static>  
validanguage.resolveArray(args, returnType, ignoreCommas)
This function accepts as input a function, a string, an array of functions, an array of strings, or a comma-delimited list of functon names as its argument and returns an Array of functions or strings comprising the passed arguments.
<static>  
validanguage.setCaretPos(Dom, Position)
Sets the caret at a specified position on an object
<static>  
validanguage.setValidationStatus(id, returnStatus, type, errorMsg)
This function is called from an ajax callback to report back to validanguage the status of the ajax validation.
<static>  
validanguage.showError(Text)
This function shows the error messages for failed validations by dynamically creating a div
<static>  
validanguage.showSubmitMessage(validationResult, failedValidations)
This function is intended for us as an onsubmit transformation.
<static>  
validanguage.smartCommaSplit(Comma-delimited)
This function splits a string into an array using commas as the delimiter, while being smart enough to ignore commas appearing inside parenthesis and braces.
<static>  
validanguage.sniffBrowser()
Determines roughly which browser they're using.
<static>  
validanguage.stripWhitespace()
This function will strip all the leading and trailing whitespace from a form field prior to its being validated.
<static>  
validanguage.substituteText(Array, Array)
This function replaces one subset of text with a different subset of text, such as making all uppercase letters, lowercase.
<static>  
validanguage.toggle(toggleArgs)
Transformation supporting 3 major features: toggling visibility, changing the values of form fields and adding options to select elements.
<static>  
validanguage.toggleCriteriaMet(field, criteria, settings)
Determines whether the criteria used by the toggle function has been met
<static>  
validanguage.toggleDisplay(nodeId, visibility)
Function used to hide or show a node.
<static>  
validanguage.trim()
Transformation function which strips all leading and trailing whitespace from a form field prior to validation.
<static>  
validanguage.validateCharacters(text)
Validates that a field does not contain any of the invalid characters listed in the characters validation rules.
<static>  
validanguage.validateCreditCard(text, cardTypes, testChecksum)
Validates that a valid credit card number has been supplied
<static>  
validanguage.validateDate(text, Options)
Validates that a valid date is supplied and is entered in the correct format.
<static>  
validanguage.validateDateExists(year,, month, day)
Helper function to verify a date actually exists.
<static>  
validanguage.validateEmail(text)
Validates an email address
<static>  
validanguage.validateForm(Form)
Calls the validationWrapper function on the passed form ID
<static>  
validanguage.validateIP(text)
Validates that a field contains a valid IPv4 address
<static>  
validanguage.validateKeypress(e)
Function to suppress the keys specified in validanguage.el.characters from being entered into a textarea or text box.
<static>  
validanguage.validateMaxlength(text, max)
Validates that a field is less than maxlength characters long
<static>  
validanguage.validateMinlength(text, min)
Validates that a field is greater than minlength characters long
<static>  
validanguage.validateNumeric(text)
Validates that a field is numeric
<static>  
validanguage.validatePasswordStrength(text, Argument)
Validates whether a password is adequately secure.
<static>  
validanguage.validateRegex(text, optional)
Validates the element against a user-defined regex stored in validanguage.el[id].regex.
<static>  
validanguage.validateRequired(text)
Validates whether or not an element has been filled out, selected or checked.
<static>  
This function calls the validateRequired method on the "master/required" form field when the "alternative" form field is clicked and then calls the appropriate onerorr/onsuccess function.
<static>  
validanguage.validateRequiredChild(text)
Child function called by validateRequired to validates whether or not an element has been filled out, selected or checked.
<static>  
validanguage.validateTimestamp(text, Options)
Validates that the entered text is a valid timestamp.
<static>  
validanguage.validateURL(text)
Validates a URL
<static>  
validanguage.validateUSPhoneNumber(text)
Validates that a US Phone number is entered
<static>  
validanguage.validateUSSSN(text)
Validates that a US Social Security Number is entered
<static>  
validanguage.validateUSZipCode(text)
Validates that a US zip code was entered
<static>  
validanguage.validationWrapper(Event, Custom, ajaxLookupIndex)
This is a wrapper for all the validation event handlers assigned to both form field element and to forms themselves.
Namespace Detail
validanguage
The validanguage library was written by DrLongGhost in 2008. See attached MIT_License.js and readme.txt for licensing and documentation. Visit http://www.drlongghost.com/validanguage.php for updates.
Author: DrLongGhost.
Field Detail
<static> validanguage.useLibrary
Valid values are 'none', 'dojo', 'jquery', 'prototype', and 'scriptaculous'.
Default Value:
'none'
Method Detail
<static> validanguage.$(DomNode)
Omnipresent dollar function. Converts an ID to a domNode
Parameters:
{String|DomNode} DomNode
or its ID

<static> validanguage.addEvent(Object, Event, Function)
Generic cross-browser addEvent() function.
Parameters:
{Object} Object
to receive the event
{Object} Event
type
{Object} Function
to be called

<static> validanguage.addEventInit()
Reassigns the validanguage.addEvent function, if an external library is being used.

<static> validanguage.addOrCreateValidationWrapper(Form, eventType,, validationsCounter,)
This function wraps multiple validanguage.el.elemId.validations event handlers and transformations within a single wrapper to call all loaded validations/transformations and exit as soon as a validation returns false.
Parameters:
{Object} Form
element object
{string} eventType,
such as "blur" or "keydown"
{integer} validationsCounter,
denotes the array index of this item in validanguage.el.elemId.validations

<static> validanguage.addValidation(elemId, eventTypes, validationNames)
This function is used to either load a new validation for a form field, or to reactivate a validation previously removed with the removeValidation() method. NOTE: When adding a new validation, you will need to have previously inserted all the relevant details about the validation in the validanguage.el.formField object.
Parameters:
{String} elemId
{String/Array} eventTypes
{String/Array/Function} validationNames

<static> validanguage.ajax(url, callback)
Very simple AJAX function
Parameters:
{String} url
{Function} callback

<static> validanguage.ajaxInit()
Initializes validanguage.ajax as browser-specific

<static> validanguage.ajaxValidationWrapper(ID, Event)
This function is called by setInterval and is used to check whether or not all ajax callbacks for a form have returned.
Parameters:
{String} ID
or index of the form
{String} Event
Type

<static> validanguage.callToggleTransformationsOnload()
This function loads all the validanguage.toggle() rules which are defined for a form following document.onload()

<static> validanguage.concatCollection(obj1, obj2)
Combines 2 node lists into 1
Parameters:
{Object} obj1
{Object} obj2

<static> validanguage.contains(node, node)
Determines whether the passed domNode is contained within the passed parentNode. Useful for telling if a form field belongs to a given form or DIV. *
Parameters:
{Object|String} node
or ID
{Object|String} node
or ID

<static> validanguage.empty(testVar, falseIsEmpty)
Emulates PHP's empty() function. For convenience, you can specify whether boolean false is considered empty. Defaults to false is NOT empty. Ignores functions.
Parameters:
{Object} testVar
{bool} falseIsEmpty

<static> validanguage.format(Pattern, String, Regular)
This is a preset transformation which is used to reformat text input to match a desired pattern
Parameters:
{String} Pattern
using x to represent alphanumeric characters. For example: "(xxx) xxx-xxxx"
{String} String
listing any characters to be removed from the form field's value prior to potential reformatting. INCLUDE ALL the delimiters used in "pattern" For example: "()- "
{String/Regex} Regular
expression which, if provided, will be used to determine whether or not to proceed with reformatting. If not provided, the function will only reformat if the number of characters in the form field (after stripThese is applied) matches the number of x's in the provided pattern

<static> validanguage.getAjaxLookupIndex(element, counter)
This function iterates thru the ajaxLookup array and returns the index number corresponding to the passed counter value
Parameters:
{String} element
ID
{Object} counter

<static> validanguage.getCaretPos(obj)
Gets the current caret position on an object
Parameters:
{Object} obj

<static> validanguage.getComments(el)
Fetches all comment nodes in the passed form node and returns them in a node list Doesnt work in konqueror, since konqueror strips all comments from the DOM
Parameters:
{Containing Node} el

<static> validanguage.getDateTimeDefaultOptions(options, defaults)
Helper function used by validateDate() and validateTimestamp().
Parameters:
{Object} options
object provided by the user to validateDate() or validateTimestamp().
{Object} defaults
which should be used. Used to allow validateDate() and validateTimestamp() to have different default dateOrder values.

<static> validanguage.getElSetting(Name, ID)
This function checks for a given setting in increasing specificity within the validanguage.forms[formId].settings object, and within the passed validanguage.el objects
Parameters:
{string} Name
of the setting to be retrieved
{string} ID
of the form field object being validated
{Object} validanguage.el.objId.validations[index]
object

<static> validanguage.getFormId(Form)
This function returns the Id of the parent Form for an element
Parameters:
{String|DomNode} Form
node or its ID

<static> {Object} validanguage.getFormSettings(id)
This function returns the validanguage.form[formId].setting object for the passed element ID
Parameters:
{string or Node} id
of the input field or input node
Returns:
{Object} settings object

<static> {String} validanguage.getSettingFromComment(Name, Full)
This function parses the passed comment to retrieve the indicated setting
Parameters:
{String} Name
of the setting to retrieve / needle
{String} Full
text of the HTML comment / haystack
Returns:
{String} The value of the requested setting

<static> validanguage.hideError()
This function hides the div containing the validanguage error messages for failed validations

<static> validanguage.inArray(needle, haystack)
Determines whether the passed item is present in the array or object.
Parameters:
{Object} needle
{Object} haystack

<static> validanguage.inheritIfDefined(settingsHaystack, settingsNeedles, settingsTarget, constrainType)
This function searches settingsHaystack for all variables defined in the settingsNeedles array, and if they are located, they are copied over to the settingsTarget
Parameters:
{Object} settingsHaystack
-- Object location to be searched for settings
{Array} settingsNeedles
-- Array of settings to be checked
{Object} settingsTarget
-- Object location where any defined settings should be copied to
{String} constrainType
-- Optional type constraint

<static> validanguage.init()
Initialization function for validanguage. Adds the onload hook which fires off the populate() method to add all the other event handlers

<static> validanguage.insertAfter(nodeToAdd, referenceNode)
Function to insert 1 Node after another in the DOM. If the referenceNode is a label, this function will use the nextSibling instead
Parameters:
{Node} nodeToAdd
{Node} referenceNode

<static> validanguage.isExpiredAjax(formFieldId, ajaxCounter)
This function examines the ajaxLookup array to determine whether or not the specified ajaxCounter pertains to the most recent ajax call for that form field.
Parameters:
{String} formFieldId
{Integer} ajaxCounter

<static> validanguage.loadCommentAPI(Dom, For)
This function parses all comments in the current document, looking for the comment-based API and converts any validanguage statements it finds into the element/json-based API for further processing.
Parameters:
{Object} Dom
Node containing comments to be loaded
{Array} For
konqueror, we pass this function an Array with all the comments (retrieved via AJAX) For all other browsers, konquerorComments is undefined and we retrieve the comments normally via the DOM

<static> validanguage.loadElAPI((Optional))
This function parses the validanguage.el object to load all the form-element-specific validation settings which the end user has defined via the Object-based API
Parameters:
{String|Object} (Optional)
If provided, this is either a DOM node or a node's ID. Providing a DOM node will limit the function to loading validations for only elements contained within that node, or if the node is a form field itself, limit to only that field.

<static> validanguage.loadForm(form)
This function loads a form and its settings into the global validanguage object so it can receive validation criteria. If the form does not have an ID, one is assigned.
Parameters:
{String|Object} form
Node or ID of the form

<static> validanguage.loadNewFields(containingElement)
This function loads all the validation rules specified within the passed element. For example, if it is passed a DIV, all the validation rules in that DIV will be loaded. This supports both the comment API and the Object API. However, if you are using the object API with an AJAX request, you may need to find the script tags within the returned HTML and eval() them prior to calling loadNewFields(). Also, be aware that you can mess up your form's validation by loading rules which have already been loaded once. Be sure that the DIV or form field which you give to the loadNewFields() function doesn't contain validations which have previously been loaded, or unexpected issues may arise.
Parameters:
{String|DomNode} containingElement
or its ID

<static> {Array} validanguage.parseSubstring(startChar, endChar, subject)
This function searches the passed subject and returns an Array of strings which are delimited by the characters passed to the function in the first 2 arguments. Used to pull comments from the document source
Parameters:
{String} startChar
{String} endChar
{String} subject
Returns:
{Array}

<static> validanguage.populate()
Main function to be called onload to load all the validations

<static> validanguage.remainingChars()
This transformation function updates a div or span with the total number of characters remaining, based on a comparison between the number of characters the user has typed and the defined minLength and maxLength values for the field. See the demo page for an example.

<static> validanguage.removeAllValidations(Containing)
This function will remove all the validations for any form fields contained within the passed containing element. For example, if containingElem is a DIV that has 3 textareas inside it, all the validations for those 3 textareas will be removed. You can also call the function with no argument to remove all the validations on the current page.
Parameters:
{String|DomNode} Containing
element or its ID

<static> validanguage.removeForm(Which)
This function removes all references to a form and its elements from the global validanguage object
Parameters:
{String|DomNode} Which
form to remove

<static> validanguage.removeValidation(elemId, eventTypes, validationNames)
This function is used to deactivate a previously loaded validation. Provide the element ID of the field and a list of event types and validation names to deactivate. You can use the * character as the eventType and/or the validationName arguments to include ALL eventTypes/validationNames. NOTE: if you are tempted to use removeValidation('id','*','*'), you may be better off using validanguage.el.id.disabled=true, as this is much easier to undo later. NOTE: It is up to you to make sure no error msgs are displaying before disabling a validation. If one is showing and all validations are disabled, the onsuccess handlers used to clear the error msgs will never be called.
Parameters:
{String} elemId
{String/Array} eventTypes
{String/Array/Function} validationNames

<static> {Array of Functions} validanguage.resolveArray(args, returnType, ignoreCommas)
This function accepts as input a function, a string, an array of functions, an array of strings, or a comma-delimited list of functon names as its argument and returns an Array of functions or strings comprising the passed arguments. Example: transforms 'foo, bar' to [foo, bar]
Parameters:
{Function or String or Array} args
{String} returnType
should be either 'string' or 'function'
ignoreCommas
Returns:
{Array of Functions}

<static> validanguage.setCaretPos(Dom, Position)
Sets the caret at a specified position on an object
Parameters:
{Object} Dom
Node
{Object} Position

<static> validanguage.setValidationStatus(id, returnStatus, type, errorMsg)
This function is called from an ajax callback to report back to validanguage the status of the ajax validation.
Parameters:
{Object} id
Id of the form field associated with this validation
{Boolean} returnStatus
Whether or not the field is valid
{String|Integer} type
Event Type or (alternately) the ajaxCounter that can be used to check validanguage.ajaxLookup to determine the eventType
{String} errorMsg
Error message to show for the failed field

<static> validanguage.showError(Text)
This function shows the error messages for failed validations by dynamically creating a div
Parameters:
{string} Text
of the error message to be displayed

<static> validanguage.showSubmitMessage(validationResult, failedValidations)
This function is intended for us as an onsubmit transformation. It replaces the form's submit button with the text specified in settings.showSubmitMessageMessage.
Parameters:
{Object} validationResult
{Object} failedValidations

<static> {Array} validanguage.smartCommaSplit(Comma-delimited)
This function splits a string into an array using commas as the delimiter, while being smart enough to ignore commas appearing inside parenthesis and braces.
Parameters:
{string} Comma-delimited
string
Returns:
{Array}

<static> validanguage.sniffBrowser()
Determines roughly which browser they're using. Defaults to FF for anything that isnt IE, Opera, Konqueror or Safari, which assuming the browser is standards-compliant, should be good enough for what I'm using it for. Yea, yea, I know....

<static> validanguage.stripWhitespace()
This function will strip all the leading and trailing whitespace from a form field prior to its being validated.

<static> validanguage.substituteText(Array, Array)
This function replaces one subset of text with a different subset of text, such as making all uppercase letters, lowercase.
Parameters:
{Array|String} Array
of characters to replace or either "upper" or "lower"
{Array|String} Array
of characters used for replacements or either "upper" or "lower"

<static> validanguage.toggle(toggleArgs)
Transformation supporting 3 major features: toggling visibility, changing the values of form fields and adding options to select elements.
Parameters:
{Array} toggleArgs
Array of objects

<static> validanguage.toggleCriteriaMet(field, criteria, settings)
Determines whether the criteria used by the toggle function has been met
Parameters:
{Object} field
{string} criteria
{Object} settings
object

<static> validanguage.toggleDisplay(nodeId, visibility)
Function used to hide or show a node. This function will also automatically disable or enable any form fields contained within the passed node.
Parameters:
{Object} nodeId
ID of the node to hide/show
{Object} visibility
(optional) Pass either 'none' or '' to hide/show. Or leave blank to toggle

<static> validanguage.trim()
Transformation function which strips all leading and trailing whitespace from a form field prior to validation.

<static> validanguage.validateCharacters(text)
Validates that a field does not contain any of the invalid characters listed in the characters validation rules.
Parameters:
{string} text

<static> validanguage.validateCreditCard(text, cardTypes, testChecksum)
Validates that a valid credit card number has been supplied
Parameters:
{string} text
{array} cardTypes
{boolean} testChecksum
Pass false to skip the luhn checksum test

<static> validanguage.validateDate(text, Options)
Validates that a valid date is supplied and is entered in the correct format. The format is specified by the following arguments
Parameters:
{String} text
to be validated
{Object} Options
object containing any of the following options
dateOrder: {String} This must be either 'ymd','mdy','dmy','myd','ydm', or 'dym
allowedDelimiters: {String}. A string containing the list of delimiters which are allowed. Example: './-'
twoDigitYearsAllowed: {Boolean}. Is a 2-digit year valid
oneDigitDaysAndMonthsAllowed: {Boolean}. Is a 1-digit month or a 1-digit day valid
maxYear: {Integer}. Years greater than maxYear will be treated as invalid. Defaults to 15 years from today
minYear: {Integer}. Years less than minYear will be treated as invalid. Defaults to 1900
rejectDatesInTheFuture: {Boolean}. Are dates in the future valid? rejectDatesInTheFuture defaults to false
rejectDatesInThePast: {Boolean}. Are dates in the past valid? rejectDatesInThePast defaults to false

<static> {Boolean} validanguage.validateDateExists(year,, month, day)
Helper function to verify a date actually exists. Used to reject values such as "12/35/2009"
Parameters:
{integer} year,
preferably 4-digit
{integer} month
{integer} day
Returns:
{Boolean}

<static> validanguage.validateEmail(text)
Validates an email address
Parameters:
text

<static> {Object} validanguage.validateForm(Form)
Calls the validationWrapper function on the passed form ID
Parameters:
{String|Form Node} Form
node or its ID
Returns:
{Object} Object containing 2 elements: Object.result is a boolean to indicate whether any fields in the form failed validation Object.failedValidations will contain info detailing any form fields with failed validations

<static> validanguage.validateIP(text)
Validates that a field contains a valid IPv4 address
Parameters:
text

<static> validanguage.validateKeypress(e)
Function to suppress the keys specified in validanguage.el.characters from being entered into a textarea or text box. This function must be forked to fetch the keyCode and differentiate between control and non-control characters. For example: in Mozilla both the delete key and . equate to 46. We dont fork based on supported functions because IE and Moz event models for keyCodes/charCodes are different and confusing, so we're better off sniffing the browser.
Parameters:
{Event Object} e

<static> validanguage.validateMaxlength(text, max)
Validates that a field is less than maxlength characters long
Parameters:
{string} text
max

<static> validanguage.validateMinlength(text, min)
Validates that a field is greater than minlength characters long
Parameters:
{string} text
min

<static> validanguage.validateNumeric(text)
Validates that a field is numeric
Parameters:
{string} text

<static> validanguage.validatePasswordStrength(text, Argument)
Validates whether a password is adequately secure. Additionally, this function can display a password strength meter, based on the same, or different, criteria than whether or not it validates. With default arguments, a password must contain at least one letter and one number and be 6 characters long, but you can easily make the requirements more stringent.
Parameters:
{String} text
{Object} Argument
object. The following options are supported:
args.minLength: Minlength for the password
args.minStrength: Minimum strength for the password to validate. This is a number from 1 to 4 to indicate how many character types it must have.
args.mustMatch: Array of character types which password must have to validate. For example, to require all 4 you would use args.mustMatch = ['hasUpper','hasLower', 'hasDigit','hasSpecial']
args.strong: Used for password meter. Array of numbers determining what qualifies as a "strong" password. For example: args.strong = [4] // All 4 char types
args.medium: Used for password meter. Array of numbers determining what qualifies as a "medium" password. For example: args.medium = [2,3] // 2 or 3 char types If a password doesn't qualify as strong or medium, then it defaults to weak.

<static> validanguage.validateRegex(text, optional)
Validates the element against a user-defined regex stored in validanguage.el[id].regex. Modifiers are supported by supplying them in obj within the regex, or, *if obj is a string*, you can pass the modifiers in obj.modifiers.
Parameters:
{string} text
{object} optional
object containing regex settings. Supports "errorOnMatch" and "modifiers"

<static> validanguage.validateRequired(text)
Validates whether or not an element has been filled out, selected or checked. This function is a wrapper which calls validateRequiredChild()
Parameters:
{string} text

<static> validanguage.validateRequiredAlternatives(e)
This function calls the validateRequired method on the "master/required" form field when the "alternative" form field is clicked and then calls the appropriate onerorr/onsuccess function.
Parameters:
e

<static> validanguage.validateRequiredChild(text)
Child function called by validateRequired to validates whether or not an element has been filled out, selected or checked. validateRequiredChild is required to add support for the requiredAlternatives array.
Parameters:
{string} text

<static> validanguage.validateTimestamp(text, Options)
Validates that the entered text is a valid timestamp. The options object supports all the options listed under the validateDate function as well as the following additional onces
Parameters:
{String} text
to be validated
{Object} Options
object containing any of the following options:
timeIsRequired: {Boolean} Is a date which is provided without an accompanying time considered a valid timestamp? timeIsRequired defaults to false.
timeUnits: {String} A string containing a list of all the time units which are allowed to be entered in the timestamp. These may include any of the following: h for hours, m for minutes, s for seconds, u for microseconds, and t for timezone. Example: "hms" for hours, minutes and seconds or "hmsut" for all 5 units. Defaults to "hms"
microsecondPrecision {Integer} Indicates the supported number of decimal places for the microseconds. Defaults to 6.

<static> validanguage.validateURL(text)
Validates a URL
Parameters:
{string} text

<static> validanguage.validateUSPhoneNumber(text)
Validates that a US Phone number is entered
Parameters:
{string} text

<static> validanguage.validateUSSSN(text)
Validates that a US Social Security Number is entered
Parameters:
{string} text

<static> validanguage.validateUSZipCode(text)
Validates that a US zip code was entered
Parameters:
{string} text

<static> validanguage.validationWrapper(Event, Custom, ajaxLookupIndex)
This is a wrapper for all the validation event handlers assigned to both form field element and to forms themselves. This function also calls any transformations before running the validations. We use a wrapper for a number of reasons, including exiting validation early as soon as a single validation function fails.
Parameters:
{Event|String} Event
object or Node ID
{String} Custom
Event
{Number} ajaxLookupIndex

Documentation generated by JsDoc Toolkit 2.0.2 on Sat Jul 30 2011 09:26:32 GMT-0400 (EDT)