inputEx Documentation Back to homepage

### inputEx Documentation > UpperCaseField.js 0.2.2

This is the source view for UpperCaseField.js

(function() { var inputEx = YAHOO.inputEx; /** * @class A field where the value is always uppercase * @extends inputEx.StringField * @constructor * @param {Object} options inputEx.Field options object */ inputEx.UpperCaseField = function(options) { inputEx.UpperCaseField.superclass.constructor.call(this,options); }; YAHOO.lang.extend(inputEx.UpperCaseField, inputEx.StringField, /** * @scope inputEx.UpperCaseField.prototype */ { /** * Set the value and call toUpperCase * @param {String} val The string * @param {boolean} [sendUpdatedEvt] (optional) Wether this setValue should fire the updatedEvt or not (default is true, pass false to NOT send the event) */ setValue: function(val, sendUpdatedEvt) { // don't always rewrite the value to able selections with Ctrl+A var uppered = val.toUpperCase(); if(uppered != this.getValue()) { inputEx.UpperCaseField.superclass.setValue.call(this, uppered, sendUpdatedEvt); } }, /** * Call setvalue on input to update the field with upper case value * @param {Event} e The original 'input' event */ onKeyPress: function(e) { inputEx.UpperCaseField.superclass.onKeyPress.call(this,e); // Re-Apply a toUpperCase method YAHOO.lang.later(0,this,function() {this.setValue( (this.getValue()) );}); } }); /** * Register this class as "uppercase" type */ inputEx.registerType("uppercase", inputEx.UpperCaseField); })();

Copyright (c) 2007-2009 Eric Abouaf. All rights reserved.
Generated by JsDoc Toolkit 2.0.0 on Wed, 04 Mar 2009 15:41:30 GMT using neyricjslibs-template.