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
e5057b0b
Commit
e5057b0b
authored
Jan 30, 2024
by
Owen Ryan Ang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify schema for readOnly, implemented on string fields.
parent
eca04648
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
8 deletions
+22
-8
generateFields.js
...bContent/WebGde-Widgets/DataInputWidget/generateFields.js
+18
-6
REG-INP.json
WebGde/WebContent/WebGde-Widgets/sample_schema/REG-INP.json
+4
-2
No files found.
WebGde/WebContent/WebGde-Widgets/DataInputWidget/generateFields.js
View file @
e5057b0b
...
...
@@ -271,7 +271,7 @@ const inputHidden = (key, validation) => {
* @returns
* created input field element
*/
const
inputString
=
(
key
,
validation
)
=>
{
const
inputString
=
(
key
,
validation
,
readOnly
)
=>
{
try
{
const
{
mandatory
,
...
...
@@ -286,6 +286,12 @@ const inputString = (key, validation) => {
input
.
setAttribute
(
'autocomplete'
,
'off'
)
input
.
addEventListener
(
'focusout'
,
handleInput
)
// add readonly attribute if set to true
if
(
readOnly
)
{
input
.
setAttribute
(
'readonly'
,
'true'
);
}
if
(
fieldLength
>=
31
&&
fieldLength
<=
60
)
{
input
=
document
.
createElement
(
'TEXTAREA'
)
input
.
setAttribute
(
'rows'
,
2
)
...
...
@@ -1570,7 +1576,7 @@ const inputGeoTag = (key, validation) => {
* @returns
* created input field element
*/
const inputDropdown = (key, validation) => {
const inputDropdown = (key, validation
, readOnly
) => {
try {
const { mandatory, options } = validation;
const input = document.createElement('
select
');
...
...
@@ -1579,6 +1585,11 @@ const inputDropdown = (key, validation) => {
input.setAttribute('
name
', `${key}`);
input.classList.add('
dropdown
-
input
');
if (readOnly) {
input.setAttribute('
readonly
', '
true
');
}
$(input).select2();
$(input).on('
select2
:
select
', function (e) {
...
...
@@ -1743,13 +1754,14 @@ const deconstruct = async (section, container, classAttribute) => {
for (const key in section) {
const {
fieldLabel, hidden
fieldLabel, hidden
, readOnly
} = section[key]
const validation = getValidation(key, schema)
const { mandatory } = validation;
if (hidden) {
const hiddenField = document.createElement('
div
') // will contain input field and label
hiddenField.setAttribute('
class
', '
fieldContainer
' + classAttribute)
...
...
@@ -1826,14 +1838,14 @@ const deconstruct = async (section, container, classAttribute) => {
case '
textarea
':
case '
alphanumeric
':
case '
email
':
input = inputString(key, validation)
input = inputString(key, validation
, readOnly
)
break
case '
alphabet
':
input = inputString(key, validation)
input = inputString(key, validation
, readOnly
)
break
case '
specific
':
case '
dropdown
':
input = inputDropdown(key, validation)
input = inputDropdown(key, validation
, readOnly
)
break
case '
numeric
':
input = inputNumeric(key, validation)
...
...
WebGde/WebContent/WebGde-Widgets/sample_schema/REG-INP.json
View file @
e5057b0b
...
...
@@ -1510,7 +1510,8 @@
"fieldLength"
:
20.0
,
"collection"
:
"alphanumeric"
,
"mandatory"
:
true
}
},
"readOnly"
:
true
},
"registered_owner"
:
{
"fieldLabel"
:
"Registered Owner"
,
...
...
@@ -1519,7 +1520,8 @@
"fieldLength"
:
20.0
,
"collection"
:
"alphanumeric"
,
"mandatory"
:
true
}
},
"readOnly"
:
true
},
"business_address"
:
{
"fieldLabel"
:
"Business Address"
,
...
...
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