commit b3c2094cd2501c7f828edcd21ec9666680ef4839
parent 013c925ec4439ad5edffa8849042d7d2c290cd84
Author: Sheng <webmaster0115@gmail.com>
Date: Sat, 10 Aug 2019 08:34:21 +0800
Only store values of the fields
Diffstat:
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/webssh/static/js/main.js b/webssh/static/js/main.js
@@ -649,9 +649,10 @@ jQuery(function($){
// use data from the arguments
var form = document.querySelector(form_id),
url = data.url || form.action,
- _xsrf = form.querySelector('input[name="_xsrf"]');
+ _xsrf = form.querySelector('input[name="_xsrf"]'),
+ data_wrapped = wrap_object(data);
- var result = validate_form_data(wrap_object(data));
+ var result = validate_form_data(data_wrapped);
if (!result.valid) {
console.log(result.msg);
return;
@@ -662,12 +663,7 @@ jQuery(function($){
data._origin = event_origin;
}
- for (var datum in data) {
- var value = data[datum];
- if (value){
- window.localStorage.setItem(datum, value);
- }
- }
+ store_items(fields, data_wrapped);
restore_items(fields);
$.ajax({