Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Register
Sign in
Toggle navigation
Menu
UPSMF
uphrh-workflow
Commits
c25b3452
Commit
c25b3452
authored
2 years ago
by
Shruti3004
Browse files
Options
Download
Patches
Plain Diff
Implemented recursive strategy for nested prefills
parent
2402f06f
main
dev
feat/centro
feature/formlistapi
fix/remove-forms
revert-67-contributeByGitpod
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
packages/form-manager/src/app.service.ts
+9
-2
packages/form-manager/src/app.service.ts
with
9 additions
and
2 deletions
+9
-2
packages/form-manager/src/app.service.ts
+
9
−
2
View file @
c25b3452
...
...
@@ -63,10 +63,11 @@ export class AppService {
}*/
for
(
const
key
in
prefillSpec
)
{
if
(
prefillSpec
.
hasOwnProperty
(
key
))
{
const
element
=
instance
.
getElementsByTagName
(
key
)[
0
];
const
key_arr
=
key
.
split
(
'
_*_
'
);
const
element
=
this
.
findElementRecursively
(
0
,
key_arr
,
instance
);
if
(
element
)
{
console
.
log
(
prefillSpec
[
key
]);
console
.
log
(
eval
(
prefillSpec
[
key
]));
//
console.log(eval(prefillSpec[key]));
element
.
textContent
=
eval
(
prefillSpec
[
key
]);
}
}
...
...
@@ -74,6 +75,12 @@ export class AppService {
return
doc
.
toString
();
}
findElementRecursively
(
start
:
number
,
key_arr
:
any
,
instance
:
any
)
{
if
(
!
instance
)
return
null
;
if
(
!
key_arr
[
start
+
1
])
return
instance
.
getElementsByTagName
(
key_arr
[
start
])?.[
0
]
return
this
.
findElementRecursively
(
start
+
1
,
key_arr
,
instance
.
getElementsByTagName
(
key_arr
[
start
])?.[
0
])
}
prefillFormXML
(
form
:
string
,
onFormSuccessData
:
any
,
prefillSpec
:
any
):
string
{
console
.
log
(
"
MAI YAHAN AA GAYA
"
);
const
formFilePath
=
join
(
__dirname
,
`forms/
${
form
}
.xml`
);
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets