Implement legacy options size & max size

This commit is contained in:
Nathan Gray 2012-03-26 23:27:53 +00:00
parent 257f823773
commit ae6809e91e

View File

@ -36,6 +36,12 @@ var et2_textbox = et2_inputWidget.extend({
"default": et2_no_init,
"description": "Field width"
},
"maxLength": {
"name": "Maximum length",
"type": "integer",
"default": et2_no_init,
"description": "Maximum number of characters allowed"
},
"blur": {
"name": "Placeholder",
"type": "string",
@ -57,6 +63,8 @@ var et2_textbox = et2_inputWidget.extend({
}
},
legacyOptions: ["size", "maxLength"],
init: function() {
this._super.apply(this, arguments);
@ -115,6 +123,18 @@ var et2_textbox = et2_inputWidget.extend({
}
},
/**
* Set maximum characters allowed
* @param _size Max characters allowed
*/
set_maxLength: function(_size) {
if (typeof _size != 'undefined' && _size != this.input.attr("maxlength"))
{
this.maxLength = _size;
this.input.attr("maxLength", this.maxLength);
}
},
set_blur: function(_value) {
if(_value) {
this.input.attr("placeholder", _value + "!"); // HTML5