-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathform-application.js
55 lines (47 loc) · 1.16 KB
/
form-application.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
class MyFormApplication extends FormApplication {
constructor(exampleOption) {
super();
this.exampleOption = exampleOption;
}
static get defaultOptions() {
return mergeObject(super.defaultOptions, {
classes: ['form'],
popOut: true,
template: `myFormApplication.html`,
id: 'my-form-application',
title: 'My FormApplication',
});
}
getData() {
// Return data to the template
return {
msg: this.exampleOption,
color: 'red',
};
}
activateListeners(html) {
super.activateListeners(html);
}
async _updateObject(event, formData) {
console.log(formData.exampleInput);
}
}
window.MyFormApplication = MyFormApplication;
/**
* To open your application
*/
new MyFormApplication('example').render(true);
/**
* myFormApplication.html
*/
<form class="flexcol">
<div class="form-group">
<label for="exampleInput">Example Input</label>
<input type="text" name="exampleInput" style="color: {{color}}" value="{{msg}}">
</div>
<footer class="sheet-footer flexrow">
<button type="submit" name="submit">
<i class="fa fa-check"></i> OK
</button>
</footer>
</form>