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
fa45756e
Commit
fa45756e
authored
Apr 22, 2018
by
Boris Kocherov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support `default` value worked with `enum`
parent
ed436c28
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
12 deletions
+18
-12
gadget_json_generated_form.js
gadget_json_generated_form.js
+18
-12
No files found.
gadget_json_generated_form.js
View file @
fa45756e
...
...
@@ -111,24 +111,30 @@
function
render_selection
(
schema
,
json_document
)
{
var
input
=
document
.
createElement
(
"
select
"
),
option
=
document
.
createElement
(
"
option
"
),
option_index
,
optionz
;
option
,
option_index
;
input
.
size
=
1
;
option
.
value
=
""
;
if
(
json_document
===
undefined
)
{
option
.
selected
=
"
selected
"
;
if
(
schema
.
default
)
{
if
(
json_document
===
undefined
)
{
json_document
=
schema
.
default
;
}
}
else
{
option
=
document
.
createElement
(
"
option
"
);
option
.
value
=
""
;
if
(
json_document
===
undefined
)
{
option
.
selected
=
"
selected
"
;
}
input
.
appendChild
(
option
);
}
input
.
appendChild
(
option
);
for
(
option_index
in
schema
[
'
enum
'
])
{
if
(
schema
[
'
enum
'
].
hasOwnProperty
(
option_index
))
{
option
z
=
document
.
createElement
(
"
option
"
);
option
z
.
value
=
schema
[
'
enum
'
][
option_index
];
option
z
.
textContent
=
schema
[
'
enum
'
][
option_index
];
option
=
document
.
createElement
(
"
option
"
);
option
.
value
=
schema
[
'
enum
'
][
option_index
];
option
.
textContent
=
schema
[
'
enum
'
][
option_index
];
if
(
schema
[
'
enum
'
][
option_index
]
===
json_document
)
{
option
z
.
selected
=
"
selected
"
;
option
.
selected
=
"
selected
"
;
}
input
.
appendChild
(
option
z
);
input
.
appendChild
(
option
);
}
}
return
input
;
...
...
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