summaryrefslogtreecommitdiffstats
path: root/extjsdemo-html.lsp
blob: 7fd9534900f7661294743844b659346dfc65d462 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<? local ctl = ... ?>

<!-- this could go in a separate .js file -->

<script type="text/javascript">

Ext.onReady(function() {
	Ext.QuickTips.init();

	// turn on validation errors beside the field globally
	Ext.form.Field.prototype.msgTarget = 'side';

	var fp = new Ext.FormPanel({
		xtype:"form",
		title:"Interface",
		buttonAlign:"right",
		id: "interface",
		items:[{
		    xtype:"fieldset",
		    title:"Eth0",
		    autoHeight:true,
		    items:[{
		        xtype:"checkbox",
		        fieldLabel:"Enable interface",
		        boxLabel:"",
		        name:"ifenable",
		        inputValue:"cbvalue"
		      },

		      // create combobox
		      new Ext.form.ComboBox({
			fieldLabel:"Type",
		        hiddenName:"iftype",
			store: new Ext.data.SimpleStore({
				fields: ['type', 'typedesc'],
				data:[
				      ['dhcp', 'Automatic (DHCP)'],
				      ['static', 'Static IP Address']
				]
			}),
			valueField: 'type',
			displayField: 'typedesc',
			typeAhead: true,
			triggerAction: 'all',
			mode: 'local',
			emptyText: 'Select Interface type...',
			allowBlank: false,
			selectOnFocus: true
		      }),
		      {
		        xtype:"textfield",
		        fieldLabel:"Address",
		        name:"address",
//			allowBlank: false
		      },{
		        xtype:"textfield",
		        fieldLabel:"Netmask",
		        name:"mask",
//			allowBlank: false
		      },{
		        xtype:"textfield",
		        fieldLabel:"Gateway",
		        name:"gateway"
		      }]
		  }],
	});

	var applybt = fp.addButton({
		text: 'Apply',
//		disabled: true,
		handler: function() {
			fp.getForm().submit({
				url: 'submit',
				waitMsg: 'Saving Data...'
			});
		}
	});

	fp.render('interface-example');

	// this connects to extjsdemo-controller.lua: load()
	fp.getForm().load({url: 'load', waitMsg: 'Loading'});

	fp.on({
	      
		actioncomplete: function(form, action) {
			if (action.type == 'submit'){
				// we disable the apply button above to indicate succes
				applybt.disable();
			}
		},
//		actionfailed: function(form, action) {
			// something failed
//			alert('form.id = ' + form.id);
//		}

	});


});
		
</script>

<h1>Extjs Test</h1>
<div id="msg"></div>
<div id="interface-example"></div>