-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.js
85 lines (81 loc) · 2.57 KB
/
index.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
$(function() {
const employee = {
name: 'John Heart',
position: 'CEO',
hireDate: new Date(2012, 4, 13),
officeNumber: 901,
phone: '+1(213) 555-9392',
skype: 'jheart_DX_skype',
email: 'jheart@dx-email.com',
notes: 'John has been in the Audio/Video industry since 1990.'
};
const form = $("#form").dxForm({
id: "form",
formData: employee,
labelLocation: "top",
showColonAfterLabel: false,
items: [{
itemType: "group",
colCount: 2,
items: [{
itemType: "group",
caption: "Employee",
items: [{
dataField: "name",
isRequired: true,
}, "position", "hireDate", {
dataField: "officeNumber",
validationRules: [{
type: "numeric",
message: "This field should contain a number"
}]
}]
}, {
itemType: "group",
caption: "Personal Information",
items: [{
itemType: "tabbed",
tabPanelOptions: {
height: 260
},
tabs: [{
title: "Contacts",
items: ["skype", "phone", {
dataField: "email",
validationRules: [{
type: "email",
message: "This is not a valid Email"
}]
}]
}, {
title: "Note",
items: [{
dataField: "notes",
editorType: "dxTextArea"
}]
}]
}]
}]
}, {
itemType: "button",
horizontalAlignment: "center",
buttonOptions: {
text: "Submit the Form",
useSubmitBehavior: true
}
}]
}).dxForm("instance");
$("#check-box").dxCheckBox({
id: "check-box",
text: "Enable read-only mode",
onValueChanged: function(e) {
form.option("readOnly", e.value);
}
});
$("#form-container").on("submit", function(e) {
setTimeout(() => {
alert("Submitted");
}, 1000);
e.preventDefault();
});
});