inputEx Documentation
Back to homepage
inputEx Documentation
> SelectField.js
1.0.0
This is the source view for SelectField.js
/** * @class Create a select field * options: * - selectValues: contains the list of options values * @extends inputEx.Field * @constructor * @param {Object} options inputEx.Field options object */ inputEx.SelectField = function(options) { inputEx.SelectField.superclass.constructor.call(this,options); }; YAHOO.lang.extend(inputEx.SelectField, inputEx.Field); /** * Build a select tag with options */ inputEx.SelectField.prototype.renderComponent = function() { this.el = inputEx.cn('select', {name: this.options.name || ''}); if (this.options.multiple) {this.el.multiple = true; this.el.size = this.options.selectValues.length;} this.optionEls = []; for( var i = 0 ; i < this.options.selectValues.length ; i++) { this.optionEls[i] = inputEx.cn('option', {value: this.options.selectValues[i]}, null, (this.options.selectOptions) ? this.options.selectOptions[i] : this.options.selectValues[i]); this.el.appendChild(this.optionEls[i]); } this.divEl.appendChild(this.el); }; /** * Register the "change" event */ inputEx.SelectField.prototype.initEvents = function() { YAHOO.util.Event.addListener(this.el,"change", this.onChange, this, true); }; /** * Set the value */ inputEx.SelectField.prototype.setValue = function(value) { var index = 0; var option; for(var i = 0 ; i < this.options.selectValues.length ; i++) { if(value === this.options.selectValues[i]) { option = this.el.childNodes[i]; option.selected = "selected"; } } }; /** * Return the value */ inputEx.SelectField.prototype.getValue = function() { return this.options.selectValues[this.el.selectedIndex]; }; /** * Register this class as "select" type */ inputEx.registerType("select", inputEx.SelectField);
Pages
Index
Getting Started
Overview
Field development
DOM functions
Internationalization
Examples
Classes
(treeview)
Array
inputEx
inputEx.AutoComplete
inputEx.CheckBox
inputEx.ColorField
inputEx.DateField
inputEx.EmailField
inputEx.Field
inputEx.Form
inputEx.FrenchDate
inputEx.FrenchPhone
inputEx.Group
inputEx.HiddenField
inputEx.InPlaceEdit
inputEx.IPv4Field
inputEx.ListField
inputEx.PairField
inputEx.PasswordField
inputEx.RTEField
inputEx.SelectField
inputEx.StringField
inputEx.Textarea
inputEx.TreeField
inputEx.TypeField
inputEx.UneditableField
inputEx.UpperCaseField
inputEx.UrlField
Files
AutoComplete.js
CheckBox.js
ColorField.js
DateField.js
EmailField.js
Field.js
Form.js
fr_messages.js
FrenchDate.js
FrenchPhone.js
Group.js
HiddenField.js
InPlaceEdit.js
inputex.js
IPv4Field.js
ListField.js
PairField.js
PasswordField.js
RTEField.js
SelectField.js
StringField.js
Textarea.js
TreeField.js
TypeField.js
UneditableField.js
UpperCaseField.js
UrlField.js
Copyright (c) 2008
Eric Abouaf
. All rights reserved.
Generated by
JsDoc Toolkit
1.4.1 on Wed, 07 May 2008 10:26:29 GMT.