Evaluates an entire form against all the validators that are set up displaying messages in-line in the page.
Extends
Implements
Syntax
new Form.Validator.Inline(form[, options]);
Arguments
- form - (mixed) A string of the id for an Element or an Element reference of the form to evaluate
- options - (object) a key/value set of options
Options
- all the options defined for [Form.Validator][], plus
- scrollToErrorsOnSubmit - (boolean) if true (the default), when the user submits the form the window (or overflown parent) will scroll up to that element so it is in view. Will use [Fx.Scroll][] if it's available, otherwise it will jump to the element.
- scrollFxOptions - (object) options for [Fx.Scroll][] if it's available; used for scrolling to errors if scrollToErrorsOnSubmit is true.
Events
- all the events defined for [Form.Validator][]
Note
-
You can define a css class-name value called msgPos as the id of an element into which the validation errors for that input will be inserted. Example:
<input class="validate-email msgPos:'emailAdvice'">
<div id="emailAdvice"></div>
Returns all the messages that an input can produce, regardless of the user input.
Syntax
myFormValidator.getAllAdviceMessages(field[, force]);
Arguments
- field - (mixed) A string of the id for an Element or an Element reference of the input
- force - (boolean; optional) if false, no messages are returned if the input has the css class 'ignoreValidation'
Returns
-
(object) An object containing information about the message. See example:
{
message: string, //The message the user would see
warnOnly: boolean, //true if this should just be a warning
passed: boolean, //true if the current value passes validation
validator: validator //the InputValidator instance
}
Retrieves the advice message for a field and a given validator name.
Syntax
myFormValidator.getAdvice(field, validatorName);
Example
myFormValidator.getAdvice(myInput, 'validate-email');
Arguments
- field - (mixed) A string of the id for an Element or an Element reference of the input.
- validatorName - (string) A string that represents the validator's name as it was added to [Form.Validator][].
Returns
- (element) A DOM element containing the message for the user.