Skip to content

Commit dc90710

Browse files
committed
small change in DynamicForm conditions
1 parent 4d688f3 commit dc90710

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/controls/dynamicForm/DynamicForm.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,8 @@ export class DynamicForm extends React.Component<IDynamicFormProps, IDynamicForm
238238

239239
}
240240
// Otherwise, depending on the content type ID of the item, if any, we need to behave accordingly
241-
else {
242-
if (contentTypeId === undefined || contentTypeId === '' || !contentTypeId.startsWith('0x0120')) {
241+
else if (contentTypeId === undefined || contentTypeId === '') {
242+
if (!contentTypeId.startsWith('0x0120')) {
243243
// We are adding a new list item
244244
try {
245245
const iar = await sp.web.lists.getById(listId).items.add(objects);
@@ -253,7 +253,7 @@ export class DynamicForm extends React.Component<IDynamicFormProps, IDynamicForm
253253
}
254254
console.log("Error", error);
255255
}
256-
} else if (contentTypeId !== undefined && contentTypeId !== '' && contentTypeId.startsWith('0x0120')) {
256+
} else if (contentTypeId.startsWith('0x0120')) {
257257
// We are adding a folder or a Document Set
258258
try {
259259
const idField = 'ID';
@@ -273,7 +273,7 @@ export class DynamicForm extends React.Component<IDynamicFormProps, IDynamicForm
273273

274274
// Set the content type ID for the target item
275275
objects[contentTypeIdField] = contentTypeId;
276-
276+
277277
// Update the just created folder or Document Set
278278
const iur = await library.items.getById(folderId).update(objects);
279279
if (onSubmitted) {

0 commit comments

Comments
 (0)