Line | |
---|
1 | /*! |
---|
2 | * Ext JS Library 3.0.0 |
---|
3 | * Copyright(c) 2006-2009 Ext JS, LLC |
---|
4 | * licensing@extjs.com |
---|
5 | * http://www.extjs.com/license |
---|
6 | */ |
---|
7 | /* |
---|
8 | * Ext JS Library 2.2 |
---|
9 | * Copyright(c) 2006-2008, Ext JS, LLC. |
---|
10 | * licensing@extjs.com |
---|
11 | * |
---|
12 | * http://extjs.com/license |
---|
13 | */ |
---|
14 | |
---|
15 | |
---|
16 | Ext.QuickTips.init(); |
---|
17 | |
---|
18 | Ext.onReady(function(){ |
---|
19 | |
---|
20 | var fp = new Ext.FormPanel({ |
---|
21 | id: 'status-form', |
---|
22 | renderTo: Ext.getBody(), |
---|
23 | labelWidth: 75, |
---|
24 | width: 350, |
---|
25 | buttonAlign: 'right', |
---|
26 | border: false, |
---|
27 | bodyStyle: 'padding:10px 10px 0;', |
---|
28 | defaults: { |
---|
29 | anchor: '95%', |
---|
30 | allowBlank: false, |
---|
31 | selectOnFocus: true, |
---|
32 | msgTarget: 'side' |
---|
33 | }, |
---|
34 | items:[{ |
---|
35 | xtype: 'textfield', |
---|
36 | fieldLabel: 'Name', |
---|
37 | blankText: 'Name is required' |
---|
38 | },{ |
---|
39 | xtype: 'datefield', |
---|
40 | fieldLabel: 'Birthdate', |
---|
41 | blankText: 'Birthdate is required' |
---|
42 | }], |
---|
43 | buttons: [{ |
---|
44 | text: 'Save', |
---|
45 | handler: function(){ |
---|
46 | if(fp.getForm().isValid()){ |
---|
47 | var sb = Ext.getCmp('form-statusbar'); |
---|
48 | sb.showBusy('Saving form...'); |
---|
49 | fp.getEl().mask(); |
---|
50 | fp.getForm().submit({ |
---|
51 | url: 'fake.php', |
---|
52 | success: function(){ |
---|
53 | sb.setStatus({ |
---|
54 | text:'Form saved!', |
---|
55 | iconCls:'', |
---|
56 | clear: true |
---|
57 | }); |
---|
58 | fp.getEl().unmask(); |
---|
59 | } |
---|
60 | }); |
---|
61 | } |
---|
62 | } |
---|
63 | }] |
---|
64 | }); |
---|
65 | |
---|
66 | new Ext.Panel({ |
---|
67 | title: 'StatusBar with Integrated Form Validation', |
---|
68 | renderTo: Ext.getBody(), |
---|
69 | width: 350, |
---|
70 | autoHeight: true, |
---|
71 | layout: 'fit', |
---|
72 | items: fp, |
---|
73 | bbar: new Ext.ux.StatusBar({ |
---|
74 | id: 'form-statusbar', |
---|
75 | defaultText: 'Ready', |
---|
76 | plugins: new Ext.ux.ValidationStatus({form:'status-form'}) |
---|
77 | }) |
---|
78 | }); |
---|
79 | |
---|
80 | }); |
---|
Note: See
TracBrowser
for help on using the repository browser.