Skip to content

Commit 3d681dc

Browse files
committed
Fixing issue #1717
Previous fix for #1568 was incomplete. New expanded fix for #1717. DefaultValue can be an object too.
1 parent 1c27a30 commit 3d681dc

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/controls/dynamicForm/DynamicForm.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -597,17 +597,26 @@ export class DynamicForm extends React.Component<
597597
hiddenName = response.value;
598598
termSetId = field.TermSetId;
599599
anchorId = field.AnchorId;
600-
if (item !== null && item[field.InternalName] !== null && item[field.InternalName].results !== null) {
600+
if (item && item[field.InternalName] && item[field.InternalName].results) {
601601
item[field.InternalName].results.forEach((element) => {
602602
selectedTags.push({
603603
key: element.TermGuid,
604604
name: element.Label,
605605
});
606606
});
607607

608+
defaultValue = selectedTags;
609+
} else if (defaultValue && defaultValue.results) {
610+
defaultValue.results.forEach((element) => {
611+
selectedTags.push({
612+
key: element.TermGuid,
613+
name: element.Label,
614+
});
615+
});
616+
608617
defaultValue = selectedTags;
609618
} else {
610-
if (defaultValue !== null && defaultValue !== "") {
619+
if (defaultValue && defaultValue !== "") {
611620
defaultValue.split(/#|;/).forEach((element) => {
612621
if (element.indexOf("|") !== -1)
613622
selectedTags.push({

0 commit comments

Comments
 (0)