-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo_advanced.js
70 lines (61 loc) · 1.42 KB
/
demo_advanced.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
"use strict"
const FormOptions = {
"prefix": 'input_',
"shareURLBtn": "#CustomShareURLBtnID",
"shareURL": "#CustomShareURL",
"clearBtn": "#CustomClearBtnID",
"FormParameters": [
{
"name": "first_name",
"queryLocation":"query",
},
{
"name": "middle_name",
},
{
"name": "last_name",
},
{
"name": "email_address",
},
{
"name": "phone_number",
},
{
"name": "country_select",
"defaultValue":1,
},
/////////////////
// Bools
////////////////
{
"name": "subscribe",
"type": "bool",
},
{
"name": "default_check",
"type": "bool",
"defaultValue":true,
},
{
"name": "toggle",
"type": "bool",
"saveSetting": true,
},
{
"name": "uri_settable",
"type": "bool",
},
{ // Tests funcTrue and nonFormValue.
"name": "customFunction", // A custom Javascript function example that has no form buttons on the page.
"type": "bool",
"funcTrue": () => document.getElementById("customFunction").textContent = "true",
"nonFormValue":true, // Value that appears in the URL, but is not in the form. This causes the URL value to be sticky for ShareURL if already set and then can only be removed by manual deletion.
},
],
};
// When the DOM is loaded initializes the `URLFormJS` module, which
// populates the sticky form using the current URL.
document.addEventListener('DOMContentLoaded', () => {
URLForm.Populate(URLForm.Init(FormOptions));
});