Skip to content

Commit

Permalink
Fixing issue pnp#1717
Browse files Browse the repository at this point in the history
Previous fix for pnp#1568 was incomplete. New expanded fix for pnp#1717. DefaultValue can be an object too.
  • Loading branch information
IRRDC committed Dec 4, 2023
1 parent 1c27a30 commit 3d681dc
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/controls/dynamicForm/DynamicForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -597,17 +597,26 @@ export class DynamicForm extends React.Component<
hiddenName = response.value;
termSetId = field.TermSetId;
anchorId = field.AnchorId;
if (item !== null && item[field.InternalName] !== null && item[field.InternalName].results !== null) {
if (item && item[field.InternalName] && item[field.InternalName].results) {
item[field.InternalName].results.forEach((element) => {
selectedTags.push({
key: element.TermGuid,
name: element.Label,
});
});

defaultValue = selectedTags;
} else if (defaultValue && defaultValue.results) {
defaultValue.results.forEach((element) => {
selectedTags.push({
key: element.TermGuid,
name: element.Label,
});
});

defaultValue = selectedTags;
} else {
if (defaultValue !== null && defaultValue !== "") {
if (defaultValue && defaultValue !== "") {
defaultValue.split(/#|;/).forEach((element) => {
if (element.indexOf("|") !== -1)
selectedTags.push({
Expand Down

0 comments on commit 3d681dc

Please sign in to comment.