Skip to content

Commit 62f3185

Browse files
Returning item instead of data for onSubmitted event
Returning item instead of data for onSubmitted event and some corrections in the documentation
1 parent a57553a commit 62f3185

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

docs/documentation/docs/controls/DynamicForm.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ This control can dynamically generate SharePoint list or SharePoint document lib
88
- Import the following modules to your component:
99

1010
```TypeScript
11-
import { DynamicForm } from "fx-controls-react/lib/DynamicForm";
11+
import { DynamicForm } from "@pnp/spfx-controls-react/lib/DynamicForm";
1212
```
1313

1414
- Use the DynamicForm control in your code as follows:
@@ -21,7 +21,7 @@ import { DynamicForm } from "fx-controls-react/lib/DynamicForm";
2121
onCancelled={() => { console.log('Cancelled') }}
2222
onBeforeSubmit={(async listItem) => { return true; }}
2323
onSubmitError={(listItem, error) => { alert(error.message); }}
24-
onSubmitted={async (listItemData) => { console.log(listItemData); }}>
24+
onSubmitted={async (listItem) => {let item = await listItem.get(); console.log(item); }}>
2525
</DynamicForm>
2626
```
2727
![DynamicForm](../assets/DynamicForm.png)

src/controls/dynamicForm/DynamicForm.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ export class DynamicForm extends React.Component<IDynamicFormProps, IDynamicForm
189189
try {
190190
const iur = await sp.web.lists.getById(listId).items.getById(listItemId).update(objects);
191191
if (onSubmitted) {
192-
onSubmitted(iur.data);
192+
onSubmitted(iur.item);
193193
}
194194
}
195195
catch (error) {
@@ -204,7 +204,7 @@ export class DynamicForm extends React.Component<IDynamicFormProps, IDynamicForm
204204
try {
205205
const iar = await sp.web.lists.getById(listId).items.add(objects);
206206
if (onSubmitted) {
207-
onSubmitted(iar.data);
207+
onSubmitted(iar.item);
208208
}
209209
}
210210
catch (error) {

0 commit comments

Comments
 (0)