src/aria/widgets/form/TextInput.js
function (report, arg) {

            var hasChange = false, cfg = this._cfg;

            if (report) {

                var resetErrorIfOK = true;
                var hasFocus = this._hasFocus;
                var stopValueProp = false;
                var delayedValidation = false;
                if (arg) {
                    resetErrorIfOK = (arg.resetErrorIfOK !== false); // true by default
                    if (arg.hasFocus != null) {
                        // replace default hasFocus property
                        hasFocus = arg.hasFocus;
                    }
                    if (arg.stopValueProp) {
                        stopValueProp = arg.stopValueProp;
                    }
                    if (arg.delayedValidation) {
                        delayedValidation = arg.delayedValidation;
                    }

                }
                if (report.errorMessages.length && this._cfg.directOnBlurValidation) {
                    this.changeProperty("formatErrorMessages", report.errorMessages);
                }
                // if the validation originated from a validation with delay we
                // do not want to update the input text or
                // value. The value will be set to 'undefined' though when the
                // entry is incorrect
                if (!delayedValidation) {
                    var text = report.text, value = report.value;
                    if (text != null && !this._helpTextSet) { // if text was
                        // an empty string (helpTextSet is 'true') do not update
                        // the display
                        var caretPosition = (report.caretPosStart != null && report.caretPosEnd != null) ? {
                            start : report.caretPosStart,
                            end : report.caretPosEnd
                        } : null;
                        if (ariaCoreBrowser.isModernIE && !caretPosition) {
                            caretPosition = this.getCaretPosition();
                        }
                        var input = this.getTextInputField();
                        // This test prevents the normal autofocus from being lost with tab, in some browsers
                        if (input.value != text) {
                            input.value = text;
                        }
                        if (caretPosition) {
                            this.setCaretPosition(caretPosition.start, caretPosition.end);
                        }
                    }
                    if (typeof value != 'undefined' && !stopValueProp && !this._isPropertyEquals("value", value)) {
                        hasChange = this.setProperty("value", value);
                    }
                }

                // setProperty on value can dispose the widget
                if (this._cfg) {
                    if (report.ok) {
                        if (resetErrorIfOK && cfg.directOnBlurValidation) {
                            this.changeProperty("formatError", false);
                        }
                    } else if (report.ok === false) {
                        if (hasFocus && report.matchCorrectValueStart) {
                            // field has the focus and entry could be correct
                            if (cfg.directOnBlurValidation) {
                                this.changeProperty("formatError", false);
                            }
                        } else {
                            if (cfg.directOnBlurValidation) {
                                this.changeProperty("formatError", true);
                            }
                        }
                        // if the text is incorrect, the bound property should
                        // be set to 'undefined'
                        if (!this._isPropertyEquals("value", report.errorValue)) {
                            hasChange = this.setProperty("value", report.errorValue);
                        }
                    }
                }

                // do this at the very end

                if (hasChange && this._cfg) {
                    // When the user modifies the field, we reset the error
                    // state until next validation:
                    this.changeProperty("error", false);
                    this.evalCallback(cfg.onchange);
                }

                report.$dispose();
            }
        }
function (report, arg) {

            var hasChange = false, cfg = this._cfg;

            if (report) {

                var resetErrorIfOK = true;
                var hasFocus = this._hasFocus;
                var stopValueProp = false;
                var delayedValidation = false;
                if (arg) {
                    resetErrorIfOK = (arg.resetErrorIfOK !== false); // true by default
                    if (arg.hasFocus != null) {
                        // replace default hasFocus property
                        hasFocus = arg.hasFocus;
                    }
                    if (arg.stopValueProp) {
                        stopValueProp = arg.stopValueProp;
                    }
                    if (arg.delayedValidation) {
                        delayedValidation = arg.delayedValidation;
                    }

                }
                if (report.errorMessages.length && this._cfg.directOnBlurValidation) {
                    this.changeProperty("formatErrorMessages", report.errorMessages);
                }
                // if the validation originated from a validation with delay we
                // do not want to update the input text or
                // value. The value will be set to 'undefined' though when the
                // entry is incorrect
                if (!delayedValidation) {
                    var text = report.text, value = report.value;
                    if (text != null && !this._helpTextSet) { // if text was
                        // an empty string (helpTextSet is 'true') do not update
                        // the display
                        var caretPosition = (report.caretPosStart != null && report.caretPosEnd != null) ? {
                            start : report.caretPosStart,
                            end : report.caretPosEnd
                        } : null;
                        if (ariaCoreBrowser.isModernIE && !caretPosition) {
                            caretPosition = this.getCaretPosition();
                        }
                        var input = this.getTextInputField();
                        // This test prevents the normal autofocus from being lost with tab, in some browsers
                        if (input.value != text) {
                            input.value = text;
                        }
                        if (caretPosition) {
                            this.setCaretPosition(caretPosition.start, caretPosition.end);
                        }
                    }
                    if (typeof value != 'undefined' && !stopValueProp && !this._isPropertyEquals("value", value)) {
                        hasChange = this.setProperty("value", value);
                    }
                }

                // setProperty on value can dispose the widget
                if (this._cfg) {
                    if (report.ok) {
                        if (resetErrorIfOK && cfg.directOnBlurValidation) {
                            this.changeProperty("formatError", false);
                        }
                    } else if (report.ok === false) {
                        if (hasFocus && report.matchCorrectValueStart) {
                            // field has the focus and entry could be correct
                            if (cfg.directOnBlurValidation) {
                                this.changeProperty("formatError", false);
                            }
                        } else {
                            if (cfg.directOnBlurValidation) {
                                this.changeProperty("formatError", true);
                            }
                        }
                        // if the text is incorrect, the bound property should
                        // be set to 'undefined'
                        if (!this._isPropertyEquals("value", report.errorValue)) {
                            hasChange = this.setProperty("value", report.errorValue);
                        }
                    }
                }

                // do this at the very end

                if (hasChange && this._cfg) {
                    // When the user modifies the field, we reset the error
                    // state until next validation:
                    this.changeProperty("error", false);
                    this.evalCallback(cfg.onchange);
                }

                report.$dispose();
            }
        }
function ( report , arg ) { var hasChange = false , cfg = this . _cfg ; if ( report ) { var resetErrorIfOK = true ; var hasFocus = this . _hasFocus ; var stopValueProp = false ; var delayedValidation = false ; if ( arg ) { resetErrorIfOK = ( arg . resetErrorIfOK !== false ) ; // true by default if ( arg . hasFocus != null ) { // replace default hasFocus property hasFocus = arg . hasFocus ; } if ( arg . stopValueProp ) { stopValueProp = arg . stopValueProp ; } if ( arg . delayedValidation ) { delayedValidation = arg . delayedValidation ; } } if ( report . errorMessages . length && this . _cfg . directOnBlurValidation ) { this . changeProperty ( "formatErrorMessages" , report . errorMessages ) ; } // if the validation originated from a validation with delay we // do not want to update the input text or // value. The value will be set to 'undefined' though when the // entry is incorrect if ( ! delayedValidation ) { var text = report . text , value = report . value ; if ( text != null && ! this . _helpTextSet ) { // if text was // an empty string (helpTextSet is 'true') do not update // the display var caretPosition = ( report . caretPosStart != null && report . caretPosEnd != null ) ? { start : report . caretPosStart , end : report . caretPosEnd } : null ; if ( ariaCoreBrowser . isModernIE && ! caretPosition ) { caretPosition = this . getCaretPosition ( ) ; } var input = this . getTextInputField ( ) ; // This test prevents the normal autofocus from being lost with tab, in some browsers if ( input . value != text ) { input . value = text ; } if ( caretPosition ) { this . setCaretPosition ( caretPosition . start , caretPosition . end ) ; } } if ( typeof value != 'undefined' && ! stopValueProp && ! this . _isPropertyEquals ( "value" , value ) ) { hasChange = this . setProperty ( "value" , value ) ; } } // setProperty on value can dispose the widget if ( this . _cfg ) { if ( report . ok ) { if ( resetErrorIfOK && cfg . directOnBlurValidation ) { this . changeProperty ( "formatError" , false ) ; } } else if ( report . ok === false ) { if ( hasFocus && report . matchCorrectValueStart ) { // field has the focus and entry could be correct if ( cfg . directOnBlurValidation ) { this . changeProperty ( "formatError" , false ) ; } } else { if ( cfg . directOnBlurValidation ) { this . changeProperty ( "formatError" , true ) ; } } // if the text is incorrect, the bound property should // be set to 'undefined' if ( ! this . _isPropertyEquals ( "value" , report . errorValue ) ) { hasChange = this . setProperty ( "value" , report . errorValue ) ; } } } // do this at the very end if ( hasChange && this . _cfg ) { // When the user modifies the field, we reset the error // state until next validation: this . changeProperty ( "error" , false ) ; this . evalCallback ( cfg . onchange ) ; } report . $dispose ( ) ; } }
React to a Controller report. The widget's controller generates a report on the internal status of the
widget. This function reads the report and sets some properties of the widget. It also reacts to changes in
the internal datamodel.
@param {aria.widgets.controllers.reports.ControllerReport} report
@param {Object} arg Optional parameters
@protected
React to a Controller report . The widget s controller generates a report on the internal status of the widget . This function reads the report and sets some properties of the widget . It also reacts to changes in the internal datamodel .