Shell.UI.Validation.js
Applies To: Windows Azure Pack
Provides methods that can be used to validate user inputs.
Widgets
None.
Enums
None.
Properties
None.
Methods
Name |
Description |
Returns |
Parameters |
---|---|---|---|
Shell.UI.Validation.addValidationCallback |
Attaches a callback the elements. You must have specified the validation container with setValidationContainer beforehand. |
jQuery.fxValidators |
elements (Object): DOM element, valid jQuery selector or jQuery elements. callback (Function): function(value, element){}. Called during child control validation. (Returns { valid: true|false|null|deferred, message: messageString }) options (Object): override options |
Shell.UI.Validation.addValidator |
Adds a new validator to convert unobtrusive HTML into validation. |
jQuery.fxValidators |
validatorName (String): The name of the validator to be added. This matches the name used in the data-val-nnnn HTML attribute (where nnnn is the validator name). params (Array): An array of parameter names (strings) that will be extracted from the data-val-nnnn-mmmm HTML attributes (where nnnn is the validator name, and mmmm is the parameter name). validate (Function): The function to call, which should return true if validated. options (Object): Options object, holding asynchronous. |
Shell.UI.Validation.helpers.appendModelPrefix |
Appends the model prefix to the value. |
String |
value (String): Value to change. prefix (String): Prefix. |
Shell.UI.Validation.helpers.checkable |
Checks if the element is a radio or checkbox. |
Boolean |
Element: The HTML element to check. |
Shell.UI.Validation.helpers.escapeAttributeValue |
Escapes the specific value for XPATH attribute search. |
String |
value (String): Value to escape. |
Shell.UI.Validation.extractValidation |
Extracts the validation parameters from the element. |
Array |
element (Object): The HTML element. |
Shell.UI.Validation.filterValidationData |
Creates an array of validation data containing only the elements of validationData that are of type runType. |
Array |
validationData (Array): Array of validation data. runType (String): Indicates which validation to run.
|
Shell.UI.Validation.helpers.format |
Formats the string with the arguments. |
String |
None. |
Shell.UI.Validation.helpers.getDependency |
Gets the validation dependencies of the element. |
Object |
element (Object): The HTML element. |
Shell.UI.Validation.helpers.getLength |
Gets the selected value length for a SELECT or INPUT or returns the length of the value. |
Boolean |
value (String): Value. element (Object): The HTML element. |
Shell.UI.Validation.helpers.getModelPrefix |
Gets the model prefix (everything before the last period). |
String |
fieldName (String): The field name. |
Shell.UI.Validation.getValidationData |
Gets the validation data from one element and saves it for future reference. |
Array |
element (Object): The HTML element. force (Boolean): Force the validation data to get fetched again. |
Shell.UI.Validation.getValidationStateFlags |
Returns the collective state of a set of validators. |
Number |
validators (Array): An array of validators. |
Shell.UI.Validation.getValidationStateName |
Returns a string representation of the pass in validation state flags. |
String |
state (Number): Validation state flags. |
Shell.UI.Validation.invalidateCache |
Invalidates the cache attached to the DOM element. |
element (Object): The HTML element. |
|
Shell.UI.Validation.parse |
Parses all the HTML elements in the specified selector. It looks for input elements decorated with the [data-val=true] attribute. It creates the correct element that can be validated in the future. |
jQuery |
selector (String): DOM element, or valid jQuery selector. options (Object): Options to pass to the jQuery UI element. |
Shell.UI.Validation.removeValidationCallback |
Removes a callback from the elements. If you do not specify any callbacks, all the group callbacks will be removed. |
Object |
elements (Object): DOM element, valid jQuery selector or jQuery elements. callback (Function): function(value, element){}. Called during child control validation. (Returns { valid: true | false | null | deferred, message: messageString }) |
Shell.UI.Validation.removeValidationContainer |
Removes container validation from elements. |
Object |
container (String): DOM element, or valid jQuery selector. callback (Function) Optional: Remove a specific callback |
Shell.UI.Validation.removeValidator |
Removes a validator by its name, if no function is provided, all the validators with that name are removed. |
jQuery.fxValidators |
validatorName (String): The name of the validator to be removed. validate (Function): The function that were call. |
Shell.UI.Validation.runValidation |
Runs the validator on the supplied values |
jQuery.fxValidators |
element (Object): The HTML element. validationData (Array): Array of validationData to be run elementValue (Object): The value to use to validate the input for any validations to be run immediately. Pass a value here if the value currently in the element is not the one you want to validate again (for example during a keypress event). If not supplied the value will be read from the element. |
Shell.UI.Validation.setValidationContainer |
Registers container element for grouped validation controls, optionally, you can attach a callback to all the elements. |
jQuery.fxValidators |
container (String): DOM element, or valid jQuery selector. element (String): DOM element, or valid jQuery selector. callback (Function): function(value, element){}. Called during child control validation. (Returns { valid: true|false|null|deferred, message: messageString }) |
Shell.UI.Validation.helpers.splitAndTrim |
Splits the value by comma and trims everything. |
Array |
value (String): Value. |
Shell.UI.Validation.validate |
Executes the validation on an element. For each validation data, there is a valid property that can be one of the following: - null: not validated - false: validation failed - true: validation passed - deferred object: validation asynchronous |
Array |
element (Object): The HTML element. |
Shell.UI.Validation.validateContainer |
Triggers validation for all the validators within a group container element, defined by addValidationContainer(container[, element], callback). |
Boolean |
selector (String): DOM element, or valid jQuery selector. |