sync
[roojs1] / Roo / bootstrap / Form.js
1 /*
2  * - LGPL
3  *
4  * form
5  * 
6  */
7
8 /**
9  * @class Roo.bootstrap.Form
10  * @extends Roo.bootstrap.Component
11  * Bootstrap Form class
12  * @cfg {String} method  GET | POST (default POST)
13  * @cfg {String} labelAlign top | left (default top)
14  * 
15  * @constructor
16  * Create a new Form
17  * @param {Object} config The config object
18  */
19
20
21 Roo.bootstrap.Form = function(config){
22     Roo.bootstrap.Form.superclass.constructor.call(this, config);
23     this.addEvents({
24         /**
25          * @event clientvalidation
26          * If the monitorValid config option is true, this event fires repetitively to notify of valid state
27          * @param {Form} this
28          * @param {Boolean} valid true if the form has passed client-side validation
29          */
30         clientvalidation: true,
31         /**
32          * @event rendered
33          * Fires when the form is rendered
34          * @param {Roo.form.Form} form
35          */
36         rendered : true
37     });
38 };
39
40 Roo.extend(Roo.bootstrap.Form, Roo.bootstrap.Component,  {
41       
42     
43      getAutoCreate : function(){
44         
45         var cfg = {
46             tag: 'form',
47             method : this.method || 'POST',
48             id : this.id || Roo.id(),
49             cls : ''
50         }
51         
52         if (this.labelAlign == 'left' ) {
53             cfg.cls += ' form-horizontal';
54         }
55         return cfg;
56     }
57     
58 });
59
60