Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
web-ui
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
WEBGDE-Components
web-ui
Commits
9bc578fc
Commit
9bc578fc
authored
Sep 11, 2023
by
Owen Ryan Ang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed implementation for generating "others" field in options.
parent
dd374a8a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
2 deletions
+16
-2
generateFields.js
...bContent/WebGde-Widgets/DataInputWidget/generateFields.js
+15
-1
NKTI_Schema.json
.../WebContent/WebGde-Widgets/sample_schema/NKTI_Schema.json
+1
-1
No files found.
WebGde/WebContent/WebGde-Widgets/DataInputWidget/generateFields.js
View file @
9bc578fc
...
@@ -466,9 +466,13 @@ const inputChecklist = (key, validation) => {
...
@@ -466,9 +466,13 @@ const inputChecklist = (key, validation) => {
var
dropdownContent
=
document
.
createElement
(
'div'
);
var
dropdownContent
=
document
.
createElement
(
'div'
);
dropdownContent
.
classList
.
add
(
'dropdown-content'
);
dropdownContent
.
classList
.
add
(
'dropdown-content'
);
dropdown1
.
appendChild
(
dropdownContent
);
dropdown1
.
appendChild
(
dropdownContent
);
var
isOther
=
false
;
// Create the checkboxes for each item
// Create the checkboxes for each item
items
.
forEach
(
function
(
item
,
index
)
{
items
.
forEach
(
function
(
item
,
index
)
{
if
(
item
.
toLowerCase
()
===
"other"
||
item
.
toLowerCase
()
===
"others"
){
isOther
=
true
;
}
else
{
var
div
=
document
.
createElement
(
'div'
);
var
div
=
document
.
createElement
(
'div'
);
div
.
classList
.
add
(
'checkbox'
);
div
.
classList
.
add
(
'checkbox'
);
...
@@ -482,8 +486,10 @@ const inputChecklist = (key, validation) => {
...
@@ -482,8 +486,10 @@ const inputChecklist = (key, validation) => {
var
label
=
document
.
createTextNode
(
item
);
var
label
=
document
.
createTextNode
(
item
);
div
.
appendChild
(
label
);
div
.
appendChild
(
label
);
dropdownContent
.
appendChild
(
div
)
dropdownContent
.
appendChild
(
div
)
}
})
})
if
(
isOther
){
// Create the checkbox dependent on an input text value
// Create the checkbox dependent on an input text value
var
dependentDiv
=
document
.
createElement
(
'div'
);
var
dependentDiv
=
document
.
createElement
(
'div'
);
dependentDiv
.
classList
.
add
(
'checkbox'
);
dependentDiv
.
classList
.
add
(
'checkbox'
);
...
@@ -520,6 +526,7 @@ const inputChecklist = (key, validation) => {
...
@@ -520,6 +526,7 @@ const inputChecklist = (key, validation) => {
inputTextBox
.
addEventListener
(
"input"
,
event
=>
{
inputTextBox
.
addEventListener
(
"input"
,
event
=>
{
dependentCheckbox
.
value
=
event
.
target
.
value
;
dependentCheckbox
.
value
=
event
.
target
.
value
;
});
});
}
return
dropdown1
;
return
dropdown1
;
}
catch
(
err
)
{
}
catch
(
err
)
{
...
@@ -546,9 +553,13 @@ const inputRadiolist = (key, validation) => {
...
@@ -546,9 +553,13 @@ const inputRadiolist = (key, validation) => {
var
dropdownContent
=
document
.
createElement
(
'div'
);
var
dropdownContent
=
document
.
createElement
(
'div'
);
dropdownContent
.
classList
.
add
(
'dropdown-content'
);
dropdownContent
.
classList
.
add
(
'dropdown-content'
);
dropdown1
.
appendChild
(
dropdownContent
);
dropdown1
.
appendChild
(
dropdownContent
);
var
isOther
=
false
;
// Create radio buttons for each item
// Create radio buttons for each item
items
.
forEach
((
item
,
index
)
=>
{
items
.
forEach
((
item
,
index
)
=>
{
if
(
item
.
toLowerCase
()
===
"other"
||
item
.
toLowerCase
()
===
"others"
){
isOther
=
true
;
}
else
{
var
radioDiv
=
document
.
createElement
(
'div'
);
var
radioDiv
=
document
.
createElement
(
'div'
);
radioDiv
.
classList
.
add
(
'radio-like-checkbox'
);
radioDiv
.
classList
.
add
(
'radio-like-checkbox'
);
...
@@ -562,8 +573,9 @@ const inputRadiolist = (key, validation) => {
...
@@ -562,8 +573,9 @@ const inputRadiolist = (key, validation) => {
radioDiv
.
appendChild
(
radio
);
radioDiv
.
appendChild
(
radio
);
radioDiv
.
appendChild
(
label
);
radioDiv
.
appendChild
(
label
);
dropdownContent
.
appendChild
(
radioDiv
);
dropdownContent
.
appendChild
(
radioDiv
);
}
});
});
if
(
isOther
){
// Create the radio button dependent on an input text value
// Create the radio button dependent on an input text value
var
dependentDiv
=
document
.
createElement
(
'div'
);
var
dependentDiv
=
document
.
createElement
(
'div'
);
dependentDiv
.
classList
.
add
(
'radio-like-checkbox'
);
dependentDiv
.
classList
.
add
(
'radio-like-checkbox'
);
...
@@ -598,6 +610,7 @@ const inputRadiolist = (key, validation) => {
...
@@ -598,6 +610,7 @@ const inputRadiolist = (key, validation) => {
dependentRadio
.
value
=
event
.
target
.
value
;
dependentRadio
.
value
=
event
.
target
.
value
;
}
}
});
});
}
return
dropdown1
;
return
dropdown1
;
}
catch
(
err
)
{
}
catch
(
err
)
{
...
@@ -815,6 +828,7 @@ const deconstruct = async (section, container, classAttribute) => {
...
@@ -815,6 +828,7 @@ const deconstruct = async (section, container, classAttribute) => {
case
'textarea'
:
case
'textarea'
:
case
'alphanumeric'
:
case
'alphanumeric'
:
case
'alphabet'
:
case
'alphabet'
:
case
'email'
:
input
=
inputString
(
key
,
validation
)
input
=
inputString
(
key
,
validation
)
break
break
case
'specific'
:
case
'specific'
:
...
...
WebGde/WebContent/WebGde-Widgets/sample_schema/NKTI_Schema.json
View file @
9bc578fc
...
@@ -73,7 +73,7 @@
...
@@ -73,7 +73,7 @@
"validation"
:
{
"validation"
:
{
"fieldLength"
:
20.0
,
"fieldLength"
:
20.0
,
"collection"
:
"radiolist"
,
"collection"
:
"radiolist"
,
"items"
:
[
"Emergency Room"
,
"Inpatient"
,
"Outpatient"
],
"items"
:
[
"Emergency Room"
,
"Inpatient"
,
"Outpatient"
,
"others"
],
"mandatory"
:
true
"mandatory"
:
true
}
}
},
},
...
...
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