inputEx Documentation Back to homepage

### inputEx Documentation > TimeField.js 0.2.2

This is the source view for TimeField.js

(function() { var inputEx = YAHOO.inputEx, Event = YAHOO.util.Event, lang = YAHOO.lang; /** * @class A field limited to number inputs (floating) * @extends inputEx.CombineField * @constructor * @param {Object} options inputEx.Field options object */ inputEx.TimeField = function(options) { var h = []; for(var i = 0 ; i < 24 ; i++) { var s="";if(i<10){s="0";} s+= i;h.push(s);} var m = []; var secs = []; for(var i = 0 ; i < 60 ; i++) { var s="";if(i<10){s="0";} s+= i;m.push(s);secs.push(s);} options.fields = [ {type: 'select', inputParams: {selectOptions: h, selectValues: h} }, {type: 'select', inputParams: {selectOptions: m, selectValues: m} }, {type: 'select', inputParams: {selectOptions: secs, selectValues: secs} } ]; options.separators = options.separators || [false,":",":",false]; inputEx.TimeField.superclass.constructor.call(this,options); }; lang.extend(inputEx.TimeField, inputEx.CombineField, /** * @scope inputEx.TimeField.prototype */ { /** * Returns a string like HH:MM:SS * @return {String} Hour string */ getValue: function() { var values = inputEx.TimeField.superclass.getValue.call(this); return values.join(':'); }, /** * Set the value * @param {String} str Hour string (format HH:MM:SS) * @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(str, sendUpdatedEvt) { inputEx.TimeField.superclass.setValue.call(this, str.split(':'), sendUpdatedEvt); } }); /** * Register this class as "time" type */ inputEx.registerType("time", inputEx.TimeField); })();

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.