Roo/form/TextItem.js
[roojs1] / Roo / form / TextItem.js
1 /*
2  * Based on:
3  * Ext JS Library 1.1.1
4  * Copyright(c) 2006-2007, Ext JS, LLC.
5  *
6  * Originally Released Under LGPL - original licence link has changed is not relivant.
7  *
8  * Fork - LGPL
9  * <script type="text/javascript">
10  */
11  
12 /**
13  * @class Roo.form.TextItem
14  * @extends Roo.BoxComponent
15  * Base class for form fields that provides default event handling, sizing, value handling and other functionality.
16  * @constructor
17  * Creates a new TextItem
18  * @param {Object} config Configuration options
19  */
20 Roo.form.TextItem = function(config){
21     Roo.form.TextItem.superclass.constructor.call(this, config);
22 };
23
24 Roo.extend(Roo.form.TextItem, Roo.BoxComponent,  {
25     /**
26      * @cfg {String/Object} autoCreate A DomHelper element spec, or true for a default element spec (defaults to
27      * {tag: "div", type: "text", size: "20", autocomplete: "off"})
28      */
29     defaultAutoCreate : {tag: "input", type: "text", size: "20", autocomplete: "new-password"},
30     
31     /**
32      * @cfg {String} tag the tag for this item (default div)
33      */
34     tag : 'div',
35     /**
36      * @cfg {String} html the content for this item (default empty)
37      */
38     html : '',
39     
40     getAutoCreate : function()
41     {
42         var cfg = {
43             tag: this.tag
44         }
45         var cfg = typeof this.autoCreate == "object" ?
46                       this.autoCreate : Roo.apply({}, this.defaultAutoCreate);
47         if(this.id && !cfg.id){
48             cfg.id = this.id;
49         }
50         return cfg;
51     },
52 });