MCPcopy Create free account
hub / github.com/Threadfin/Threadfin / saveWizard

Function saveWizard

ts/configuration_ts.ts:110–168  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

108}
109
110function saveWizard() {
111
112 var cmd = "saveWizard"
113 var div = document.getElementById("content")
114 var config = div.getElementsByClassName("wizard")
115
116 var wizard = new Object()
117
118 for (var i = 0; i < config.length; i++) {
119
120 var name:string
121 var value:any
122
123 switch (config[i].tagName) {
124 case "SELECT":
125 name = (config[i] as HTMLSelectElement).name
126 value = (config[i] as HTMLSelectElement).value
127
128 // Wenn der Wert eine Zahl ist, wird dieser als Zahl gespeichert
129 if(isNaN(value)){
130 wizard[name] = value
131 } else {
132 wizard[name] = parseInt(value)
133 }
134
135 break
136
137 case "INPUT":
138 switch ((config[i] as HTMLInputElement).type) {
139 case "text":
140 name = (config[i] as HTMLInputElement).name
141 value = (config[i] as HTMLInputElement).value
142
143 if (value.length == 0) {
144 var msg = name.toUpperCase() + ": " + "{{.alert.missingInput}}"
145 alert(msg)
146 return
147 }
148
149 wizard[name] = value
150 break
151 }
152 break
153
154 default:
155 // code...
156 break;
157 }
158
159 }
160
161 var data = new Object()
162 data["wizard"] = wizard
163
164 var server:Server = new Server(cmd)
165 server.request(data)
166
167 console.log(data)

Callers

nothing calls this directly

Calls 1

requestMethod · 0.95

Tested by

no test coverage detected