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
Jérome Perrin
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 @@
...
@@ -1411,7 +1411,7 @@
if
(
input
.
hasAttribute
(
'
data-origin-value
'
))
{
if
(
input
.
hasAttribute
(
'
data-origin-value
'
))
{
json_dict
[
input
.
name
]
=
JSON
.
parse
(
input
.
getAttribute
(
'
data-origin-value
'
));
json_dict
[
input
.
name
]
=
JSON
.
parse
(
input
.
getAttribute
(
'
data-origin-value
'
));
}
else
{
}
else
{
if
(
input
.
required
||
input
.
value
!==
""
)
{
if
(
input
.
value
!==
""
)
{
var
type
=
input
.
getAttribute
(
'
data-json-type
'
);
var
type
=
input
.
getAttribute
(
'
data-json-type
'
);
if
(
input
.
tagName
===
"
SELECT
"
&&
input
.
value
)
{
if
(
input
.
tagName
===
"
SELECT
"
&&
input
.
value
)
{
// selection used for enums
// selection used for enums
...
@@ -1445,10 +1445,18 @@
...
@@ -1445,10 +1445,18 @@
}
}
if
(
count_of_values
===
0
)
{
if
(
count_of_values
===
0
)
{
switch
(
g
.
props
.
type
)
{
switch
(
g
.
props
.
type
)
{
case
"
string
"
:
return
""
;
case
"
number
"
:
return
null
;
case
"
boolean
"
:
return
null
;
case
"
array
"
:
return
[];
case
"
object
"
:
case
"
object
"
:
return
{};
return
{};
default
:
default
:
return
null
;
return
;
}
}
}
}
return
multi_level_dict
[
""
];
return
multi_level_dict
[
""
];
...
@@ -1635,7 +1643,7 @@
...
@@ -1635,7 +1643,7 @@
property_name
=
g
.
element
.
getAttribute
(
'
data-json-property-name
'
),
property_name
=
g
.
element
.
getAttribute
(
'
data-json-property-name
'
),
schema
=
options
.
schema
,
schema
=
options
.
schema
,
root
;
root
;
g
.
props
.
change
=
false
;
g
.
props
.
change
d
=
false
;
g
.
props
.
saveOrigValue
=
options
.
saveOrigValue
;
g
.
props
.
saveOrigValue
=
options
.
saveOrigValue
;
g
.
props
.
inputs
=
[];
g
.
props
.
inputs
=
[];
g
.
props
.
add_buttons
=
[];
g
.
props
.
add_buttons
=
[];
...
@@ -1661,9 +1669,8 @@
...
@@ -1661,9 +1669,8 @@
options
.
type
=
guessSchemaType
(
schema
);
options
.
type
=
guessSchemaType
(
schema
);
}
}
// used for empty document generation
// used for empty document generation
g
.
props
.
type
=
getDocumentType
(
options
.
document
)
||
g
.
props
.
type
=
(
schema
&&
typeof
schema
.
type
===
"
string
"
&&
schema
.
type
)
||
(
schema
&&
typeof
schema
.
type
===
"
string
"
&&
schema
.
type
)
||
options
.
type
||
getDocumentType
(
options
.
document
);
options
.
type
;
while
(
root
.
firstChild
)
{
while
(
root
.
firstChild
)
{
root
.
removeChild
(
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