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
b2fe0312
Commit
b2fe0312
authored
Apr 22, 2018
by
Boris Kocherov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix render_selection()
parent
6da36ae6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
8 deletions
+9
-8
gadget_json_generated_form.js
gadget_json_generated_form.js
+9
-8
No files found.
gadget_json_generated_form.js
View file @
b2fe0312
...
@@ -112,7 +112,8 @@
...
@@ -112,7 +112,8 @@
function
render_selection
(
schema
,
json_document
)
{
function
render_selection
(
schema
,
json_document
)
{
var
input
=
document
.
createElement
(
"
select
"
),
var
input
=
document
.
createElement
(
"
select
"
),
option
,
option
,
option_index
;
i
,
enum_arr
=
schema
[
'
enum
'
];
input
.
size
=
1
;
input
.
size
=
1
;
if
(
schema
.
default
)
{
if
(
schema
.
default
)
{
if
(
json_document
===
undefined
)
{
if
(
json_document
===
undefined
)
{
...
@@ -122,17 +123,17 @@
...
@@ -122,17 +123,17 @@
option
=
document
.
createElement
(
"
option
"
);
option
=
document
.
createElement
(
"
option
"
);
option
.
value
=
""
;
option
.
value
=
""
;
if
(
json_document
===
undefined
)
{
if
(
json_document
===
undefined
)
{
option
.
selected
=
"
selected
"
;
option
.
selected
=
true
;
}
}
input
.
appendChild
(
option
);
input
.
appendChild
(
option
);
}
}
for
(
option_index
in
schema
[
'
enum
'
]
)
{
for
(
i
=
0
;
i
<
enum_arr
.
length
;
i
+=
1
)
{
if
(
schema
[
'
enum
'
].
hasOwnProperty
(
option_index
))
{
if
(
enum_arr
.
hasOwnProperty
(
i
))
{
option
=
document
.
createElement
(
"
option
"
);
option
=
document
.
createElement
(
"
option
"
);
option
.
value
=
schema
[
'
enum
'
][
option_index
];
option
.
value
=
enum_arr
[
i
];
option
.
textContent
=
schema
[
'
enum
'
][
option_index
];
option
.
textContent
=
enum_arr
[
i
];
if
(
schema
[
'
enum
'
][
option_index
]
===
json_document
)
{
if
(
enum_arr
[
i
]
===
json_document
)
{
option
.
selected
=
"
selected
"
;
option
.
selected
=
true
;
}
}
input
.
appendChild
(
option
);
input
.
appendChild
(
option
);
}
}
...
...
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