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
ed436c28
Commit
ed436c28
authored
Apr 22, 2018
by
Boris Kocherov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make code better understandable
parent
5a96bd75
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
gadget_json_generated_form.js
gadget_json_generated_form.js
+7
-7
No files found.
gadget_json_generated_form.js
View file @
ed436c28
...
...
@@ -109,23 +109,23 @@
return
schema
;
}
function
render_selection
(
json_field
,
default_value
)
{
function
render_selection
(
schema
,
json_document
)
{
var
input
=
document
.
createElement
(
"
select
"
),
option
=
document
.
createElement
(
"
option
"
),
option_index
,
optionz
;
input
.
size
=
1
;
option
.
value
=
""
;
if
(
default_value
===
undefined
)
{
if
(
json_document
===
undefined
)
{
option
.
selected
=
"
selected
"
;
}
input
.
appendChild
(
option
);
for
(
option_index
in
json_field
[
'
enum
'
])
{
if
(
json_field
[
'
enum
'
].
hasOwnProperty
(
option_index
))
{
for
(
option_index
in
schema
[
'
enum
'
])
{
if
(
schema
[
'
enum
'
].
hasOwnProperty
(
option_index
))
{
optionz
=
document
.
createElement
(
"
option
"
);
optionz
.
value
=
json_field
[
'
enum
'
][
option_index
];
optionz
.
textContent
=
json_field
[
'
enum
'
][
option_index
];
if
(
json_field
[
'
enum
'
][
option_index
]
===
default_value
)
{
optionz
.
value
=
schema
[
'
enum
'
][
option_index
];
optionz
.
textContent
=
schema
[
'
enum
'
][
option_index
];
if
(
schema
[
'
enum
'
][
option_index
]
===
json_document
)
{
optionz
.
selected
=
"
selected
"
;
}
input
.
appendChild
(
optionz
);
...
...
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