-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathwizard-demo.js
206 lines (187 loc) · 6.75 KB
/
wizard-demo.js
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
Ext.onReady(function () {
Ext.QuickTips.init();
var cards = new Array();
// first card with welcome message
cards.push(Ext.create('Ext.ux.wizard.Card', {
title: 'Sign Up',
showTitle: true,
titleCls: '',
titleStyle: 'font-size: 2.5em;',
baseCls: 'rnd1',
items: [{
border: false,
bodyStyle: 'background:none;',
html: 'Welcome to the example for <strong>Ext.ux.Wiz</string>, ' +
'an Ext JS user extension for creating wizards.<br/><br/>' +
'Please click the "next"-button and fill out all form values.'
}]
}));
// second card with input fields last/firstname
cards.push(new Ext.ux.wizard.Card({
title: 'Your name',
showTitle: true,
titleCls: '',
titleStyle: 'font-size: 2.5em;',
monitorValid: true,
baseCls: 'rnd1',
defaults: {
labelStyle: 'font-size:12px'
},
fieldDefaults: {
labelAlign: 'right',
msgTarget: 'none',
invalidCls: '' //unset the invalidCls so individual fields do not get styled as invalid
},
items: [{
border: false,
bodyStyle: 'background:none;padding-bottom:30px;',
html: 'Please enter your first- and your lastname. <br/><br/>Only letters, underscores and hyphens are allowed.'
}, { bodyStyle: 'background:lightblue;padding-bottom:30px;' },
new Ext.form.TextField({
name: 'firstname',
fieldLabel: 'Firstname',
allowBlank: false,
anchor: '50%',
validator: function (v) {
var t = /^[a-zA-Z_\- ]+$/;
return t.test(v);
}
}),
new Ext.form.TextField({
name: 'lastname',
fieldLabel: 'Lastname',
allowBlank: false,
anchor: '60%',
validator: function (v) {
var t = /^[a-zA-Z_\- ]+$/;
return t.test(v);
}
}),
new Ext.form.TextField({
name: 'company',
fieldLabel: 'Company/Group Name',
allowBlank: true,
anchor: '80%',
validator: function (v) {
var t = /^[a-zA-Z_\- ]+$/;
return t.test(v);
}
}), { bodyStyle: 'background:lightblue;padding-bottom:30px;'}]
}));
// third card with input field email-address
cards.push(new Ext.ux.wizard.Card({
title: 'User Identification',
showTitle: true,
titleCls: '',
titleStyle: 'font-size: 2.5em;',
monitorValid: true,
baseCls: 'rnd1',
margins: '10 10 10 10',
defaults: {
labelStyle: 'font-size:11px'
},
items: [{
border: false,
bodyStyle: 'background:none;padding-bottom:30px;',
html: ' Provide user login information.<br/><br/>Please pick username and <br/> enter your contact email-address to confirm.'
}, { bodyStyle: 'background:lightblue;padding-bottom:30px;' },
new Ext.form.TextField({
name: 'username',
fieldLabel: 'Username',
allowBlank: false
}),
new Ext.form.TextField({
name: 'password',
fieldLabel: 'Password',
allowBlank: false
}),
new Ext.form.TextField({
name: 'cpassword',
fieldLabel: 'Confirm Password',
allowBlank: false,
/**
* Custom validator implementation - checks that the value matches what was entered into
* the password1 field.
*/
validator: function (value) {
var password1 = this.previousSibling('[name=password]');
return (value === password1.getValue()) ? true : 'Passwords do not match.'
}
}), {
xtype: 'textfield',
name: 'email',
fieldLabel: 'Email-Address',
allowBlank: false,
vtype: 'email'
},{bodyStyle: 'background:lightblue;padding-bottom:30px;'}, {
xtype: 'checkboxfield',
name: 'receive',
checked: true,
fieldLabel: '',
boxLabel: 'I\'d like to receive communications about product information and<br/> services including tips and FAQs',
allowBlank: false
}]
}));
// fourth card with finish-message
cards.push(new Ext.ux.wizard.Card({
title: 'Finished!',
showTitle: true,
titleCls: '',
titleStyle: 'font-size: 2.5em;',
monitorValid: true,
baseCls: 'rnd1',
items: [{
border: false,
bodyStyle: 'background:none;',
html: 'Thank you for testing this wizard. Your data has been collected ' +
'and can be accessed via a call to <pre><code>this.getWizardData</code></pre>' +
'When you click on the "finish"-button, the "finish"-event will be fired.<br/>' +
'If no attached listener for this event returns "false", this dialog will be ' +
'closed. <br />'
}]
}));
var wizard = new Ext.ux.Wizard({
// title: 'A simple example for a wizard'
// no headConfig suplied no header will be shown.
headConfig: {
// title: 'Simple Wizard Head title Example',
headerPosition: 'top',
position: 'top' // or bottom
, stepText: "<center>Step {0} of {1}: {2}</center>"
},
// no sideConfig suplied no header will be shown.
sideConfig: {
// title: 'Simple Wizard Side title Example',
headerPosition: 'left',
position: 'left' // or right
},
width: 850, height: 800,
closable: false,
includeHeaderPanel: true,
includeSidePanel: true,
cardPanelConfig: {
defaults: {
baseCls: 'x-small-editor',
bodyStyle: 'padding:40px 15px 5px 120px;background-color:#F6F6F6;',
border: false
},
layout: 'card'
},
cards: cards
});
wizard.on(
'finish',
function (me, data) {
alert("done. Thanks for enterring the following data\n" + Ext.encode(data));
}
);
wizard.on(
'cancel',
function (me, data) {
alert("Sorry you cancelled.\nYou enterred\n" + Ext.encode(data));
}
);
// show the wizard
wizard.show();
});