Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
rjs_json_form
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
rjs_json_form
Commits
4d093c6c
Commit
4d093c6c
authored
May 10, 2018
by
Boris Kocherov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
getContent use empty string "" value only for required fields
parent
899c03a6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
1 deletion
+12
-1
gadget_json_generated_form_child.js
gadget_json_generated_form_child.js
+12
-1
No files found.
gadget_json_generated_form_child.js
View file @
4d093c6c
...
...
@@ -980,6 +980,7 @@
function
getFormValuesAsJSONDict
(
g
)
{
var
multi_level_dict
=
{
""
:
{}},
count_of_values
=
0
,
scope
,
options
=
g
.
props
,
array
,
...
...
@@ -998,6 +999,7 @@
if
(
ii
===
key_list
.
length
-
1
)
{
if
(
value
!==
undefined
)
{
d
[
kk
]
=
value
;
count_of_values
+=
1
;
}
else
{
return
d
[
kk
];
}
...
...
@@ -1019,6 +1021,9 @@
return
gadget
.
getContent
();
})
.
push
(
function
(
jdict
)
{
if
(
jdict
===
undefined
)
{
return
;
}
convertOnMultiLevel
(
multi_level_dict
,
path
,
jdict
);
});
}
...
...
@@ -1032,6 +1037,9 @@
return
gadget
.
getContent
();
})
.
push
(
function
(
jdict
)
{
if
(
jdict
===
undefined
)
{
return
;
}
var
arr
=
convertOnMultiLevel
(
multi_level_dict
,
parent_path
);
if
(
!
(
arr
instanceof
Array
))
{
arr
=
[];
...
...
@@ -1077,7 +1085,7 @@
var
json_dict
=
{},
k
;
g
.
props
.
inputs
.
forEach
(
function
(
input
)
{
if
(
input
.
name
===
""
||
input
.
value
!==
""
)
{
if
(
input
.
required
||
input
.
value
!==
""
)
{
if
(
input
.
type
===
'
number
'
)
{
json_dict
[
input
.
name
]
=
parseInt
(
input
.
value
,
10
);
}
else
if
(
input
.
value
===
"
true
"
)
{
...
...
@@ -1100,6 +1108,9 @@
convertOnMultiLevel
(
multi_level_dict
,
k
,
json_dict
[
k
]);
}
}
if
(
count_of_values
===
0
)
{
return
;
}
return
multi_level_dict
[
""
];
});
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment