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
8a1f11f1
Commit
8a1f11f1
authored
Aug 27, 2018
by
Boris Kocherov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
correctly return empty json_documents
parent
b7bdafad
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
6 deletions
+13
-6
jsonform/gadget_json_generated_form_child.js
jsonform/gadget_json_generated_form_child.js
+13
-6
No files found.
jsonform/gadget_json_generated_form_child.js
View file @
8a1f11f1
...
...
@@ -1411,7 +1411,7 @@
if
(
input
.
hasAttribute
(
'
data-origin-value
'
))
{
json_dict
[
input
.
name
]
=
JSON
.
parse
(
input
.
getAttribute
(
'
data-origin-value
'
));
}
else
{
if
(
input
.
required
||
input
.
value
!==
""
)
{
if
(
input
.
value
!==
""
)
{
var
type
=
input
.
getAttribute
(
'
data-json-type
'
);
if
(
input
.
tagName
===
"
SELECT
"
&&
input
.
value
)
{
// selection used for enums
...
...
@@ -1445,10 +1445,18 @@
}
if
(
count_of_values
===
0
)
{
switch
(
g
.
props
.
type
)
{
case
"
string
"
:
return
""
;
case
"
number
"
:
return
null
;
case
"
boolean
"
:
return
null
;
case
"
array
"
:
return
[];
case
"
object
"
:
return
{};
default
:
return
null
;
return
;
}
}
return
multi_level_dict
[
""
];
...
...
@@ -1635,7 +1643,7 @@
property_name
=
g
.
element
.
getAttribute
(
'
data-json-property-name
'
),
schema
=
options
.
schema
,
root
;
g
.
props
.
change
=
false
;
g
.
props
.
change
d
=
false
;
g
.
props
.
saveOrigValue
=
options
.
saveOrigValue
;
g
.
props
.
inputs
=
[];
g
.
props
.
add_buttons
=
[];
...
...
@@ -1661,9 +1669,8 @@
options
.
type
=
guessSchemaType
(
schema
);
}
// used for empty document generation
g
.
props
.
type
=
getDocumentType
(
options
.
document
)
||
(
schema
&&
typeof
schema
.
type
===
"
string
"
&&
schema
.
type
)
||
options
.
type
;
g
.
props
.
type
=
(
schema
&&
typeof
schema
.
type
===
"
string
"
&&
schema
.
type
)
||
options
.
type
||
getDocumentType
(
options
.
document
);
while
(
root
.
firstChild
)
{
root
.
removeChild
(
root
.
firstChild
);
}
...
...
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