src/aria/widgets/form/Select.js
function (propertyName, newValue, oldValue) {
            if (propertyName === 'value') {
                this._checkValue();// checks the value changed in the data model is a valid value from the select
                // options
                if (this.controller) {
                    var report = this.controller.checkValue(newValue);
                    this._reactToControllerReport(report, {
                        stopValueProp : true
                    });
                } else {
                    this._selectValue(newValue);
                }
            } else if (propertyName === 'mandatory') {
                this._updateState();
            } else if (propertyName === 'readOnly' || propertyName === 'disabled') {
                var selectField = this.getSelectField();
                var disabledOrReadonly = this.getProperty("disabled") || this.getProperty("readOnly");
                if (this._skinObj.simpleHTML) {
                    selectField.disabled = disabledOrReadonly ? "disabled" : "";
                }
                var tabIndex = disabledOrReadonly ? -1 : this._calculateTabIndex();
                selectField.tabIndex = tabIndex;
                this._updateState();
            } else if (propertyName === 'options') {
                if (this.controller) {
                    var selectValue = this.controller.getDataModel().value;
                    this.controller.setListOptions(newValue);
                    var report = this.controller.checkValue(selectValue);
                    this._reactToControllerReport(report, {
                        stopValueProp : false
                    });
                } else {
                    // markup for the options
                    var optionsMarkup = [];
                    var stringUtils = ariaUtilsString;
                    for (var i = 0, l = newValue.length; i < l; i++) {
                        // string cast, otherwise encoding will fail
                        var optValue = '' + newValue[i].value;
                        optionsMarkup.push('<option value="', stringUtils.encodeForQuotedHTMLAttribute(optValue), '">', stringUtils.escapeHTML(newValue[i].label), '</option>');
                    }

                    var selectField = this.getSelectField();
                    var currentValue = selectField.value;
                    // update the options list
                    var optionsListString = optionsMarkup.join('');
                    if (ariaCoreBrowser.isIE9 || ariaCoreBrowser.isIE8 || ariaCoreBrowser.isIE7) {
                        // innerHTML replacing in IE truncates the first element and breaks the whole select...
                        selectField.innerHTML = '';
                        var helperDiv = Aria.$window.document.createElement('div');
                        helperDiv.innerHTML = '<select>' + optionsListString + '</select>';
                        var options = helperDiv.children[0].children;
                        while (options.length) {
                            selectField.appendChild(options[0]);
                        }
                    } else {
                        selectField.innerHTML = optionsListString;
                    }
                    this._selectValue(currentValue);
                }

            } else if (propertyName === 'formatError' || propertyName === 'formatErrorMessages'
                    || propertyName === 'error' || propertyName === 'errorMessages') {
                this._cfg[propertyName] = newValue;
                this._updateState();
            } else {
                this.$DropDownInput._onBoundPropertyChange.apply(this, arguments);
            }
        }
function (propertyName, newValue, oldValue) {
            if (propertyName === 'value') {
                this._checkValue();// checks the value changed in the data model is a valid value from the select
                // options
                if (this.controller) {
                    var report = this.controller.checkValue(newValue);
                    this._reactToControllerReport(report, {
                        stopValueProp : true
                    });
                } else {
                    this._selectValue(newValue);
                }
            } else if (propertyName === 'mandatory') {
                this._updateState();
            } else if (propertyName === 'readOnly' || propertyName === 'disabled') {
                var selectField = this.getSelectField();
                var disabledOrReadonly = this.getProperty("disabled") || this.getProperty("readOnly");
                if (this._skinObj.simpleHTML) {
                    selectField.disabled = disabledOrReadonly ? "disabled" : "";
                }
                var tabIndex = disabledOrReadonly ? -1 : this._calculateTabIndex();
                selectField.tabIndex = tabIndex;
                this._updateState();
            } else if (propertyName === 'options') {
                if (this.controller) {
                    var selectValue = this.controller.getDataModel().value;
                    this.controller.setListOptions(newValue);
                    var report = this.controller.checkValue(selectValue);
                    this._reactToControllerReport(report, {
                        stopValueProp : false
                    });
                } else {
                    // markup for the options
                    var optionsMarkup = [];
                    var stringUtils = ariaUtilsString;
                    for (var i = 0, l = newValue.length; i < l; i++) {
                        // string cast, otherwise encoding will fail
                        var optValue = '' + newValue[i].value;
                        optionsMarkup.push('<option value="', stringUtils.encodeForQuotedHTMLAttribute(optValue), '">', stringUtils.escapeHTML(newValue[i].label), '</option>');
                    }

                    var selectField = this.getSelectField();
                    var currentValue = selectField.value;
                    // update the options list
                    var optionsListString = optionsMarkup.join('');
                    if (ariaCoreBrowser.isIE9 || ariaCoreBrowser.isIE8 || ariaCoreBrowser.isIE7) {
                        // innerHTML replacing in IE truncates the first element and breaks the whole select...
                        selectField.innerHTML = '';
                        var helperDiv = Aria.$window.document.createElement('div');
                        helperDiv.innerHTML = '<select>' + optionsListString + '</select>';
                        var options = helperDiv.children[0].children;
                        while (options.length) {
                            selectField.appendChild(options[0]);
                        }
                    } else {
                        selectField.innerHTML = optionsListString;
                    }
                    this._selectValue(currentValue);
                }

            } else if (propertyName === 'formatError' || propertyName === 'formatErrorMessages'
                    || propertyName === 'error' || propertyName === 'errorMessages') {
                this._cfg[propertyName] = newValue;
                this._updateState();
            } else {
                this.$DropDownInput._onBoundPropertyChange.apply(this, arguments);
            }
        }
function ( propertyName , newValue , oldValue ) { if ( propertyName === 'value' ) { this . _checkValue ( ) ; // checks the value changed in the data model is a valid value from the select // options if ( this . controller ) { var report = this . controller . checkValue ( newValue ) ; this . _reactToControllerReport ( report , { stopValueProp : true } ) ; } else { this . _selectValue ( newValue ) ; } } else if ( propertyName === 'mandatory' ) { this . _updateState ( ) ; } else if ( propertyName === 'readOnly' || propertyName === 'disabled' ) { var selectField = this . getSelectField ( ) ; var disabledOrReadonly = this . getProperty ( "disabled" ) || this . getProperty ( "readOnly" ) ; if ( this . _skinObj . simpleHTML ) { selectField . disabled = disabledOrReadonly ? "disabled" : "" ; } var tabIndex = disabledOrReadonly ? - 1 : this . _calculateTabIndex ( ) ; selectField . tabIndex = tabIndex ; this . _updateState ( ) ; } else if ( propertyName === 'options' ) { if ( this . controller ) { var selectValue = this . controller . getDataModel ( ) . value ; this . controller . setListOptions ( newValue ) ; var report = this . controller . checkValue ( selectValue ) ; this . _reactToControllerReport ( report , { stopValueProp : false } ) ; } else { // markup for the options var optionsMarkup = [ ] ; var stringUtils = ariaUtilsString ; for ( var i = 0 , l = newValue . length ; i < l ; i ++ ) { // string cast, otherwise encoding will fail var optValue = '' + newValue [ i ] . value ; optionsMarkup . push ( '<option value="' , stringUtils . encodeForQuotedHTMLAttribute ( optValue ) , '">' , stringUtils . escapeHTML ( newValue [ i ] . label ) , '</option>' ) ; } var selectField = this . getSelectField ( ) ; var currentValue = selectField . value ; // update the options list var optionsListString = optionsMarkup . join ( '' ) ; if ( ariaCoreBrowser . isIE9 || ariaCoreBrowser . isIE8 || ariaCoreBrowser . isIE7 ) { // innerHTML replacing in IE truncates the first element and breaks the whole select... selectField . innerHTML = '' ; var helperDiv = Aria . $window . document . createElement ( 'div' ) ; helperDiv . innerHTML = '<select>' + optionsListString + '</select>' ; var options = helperDiv . children [ 0 ] . children ; while ( options . length ) { selectField . appendChild ( options [ 0 ] ) ; } } else { selectField . innerHTML = optionsListString ; } this . _selectValue ( currentValue ) ; } } else if ( propertyName === 'formatError' || propertyName === 'formatErrorMessages' || propertyName === 'error' || propertyName === 'errorMessages' ) { this . _cfg [ propertyName ] = newValue ; this . _updateState ( ) ; } else { this . $DropDownInput . _onBoundPropertyChange . apply ( this , arguments ) ; } }
Internal method called when the value property that the select is bound to has changed.
@param {String} propertyName the property name
@param {Object} newValue the new value
@param {Object} oldValue the old property value
@protected
Internal method called when the value property that the select is bound to has changed .