Skip to content

Commit 9440e80

Browse files
authored
Update DynamicForm.md
Add additional description on how to cancel the submit. Changed the return value in the example to 'false' to make it less misleading that 'true' is the default value to continue submitting.
1 parent 256d4a7 commit 9440e80

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

docs/documentation/docs/controls/DynamicForm.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { DynamicForm } from "@pnp/spfx-controls-react/lib/DynamicForm";
1919
listId={"3071c058-549f-461d-9d73-8b9a52049a80"}
2020
listItemId={1}
2121
onCancelled={() => { console.log('Cancelled') }}
22-
onBeforeSubmit={async (listItem) => { return true; }}
22+
onBeforeSubmit={async (listItem) => { return false; }}
2323
onSubmitError={(listItem, error) => { alert(error.message); }}
2424
onSubmitted={async (listItemData) => { console.log(listItemData); }}>
2525
</DynamicForm>
@@ -38,7 +38,7 @@ The `DynamicForm` can be configured with the following properties:
3838
| contentTypeId | string | no | content type ID |
3939
| disabled | boolean | no | Allows form to be disabled. Default value is `false`|
4040
| disabledFields | string[] | no | InternalName of fields that should be disabled. Default value is `false`|
41-
| onBeforeSubmit | (listItemData: any) => Promise&lt;boolean&gt; | no | Before submit handler. Allows to modify the object to be submitted or cancel the submission. |
41+
| onBeforeSubmit | (listItemData: any) => Promise&lt;boolean&gt; | no | Before submit handler. Allows to modify the object to be submitted or cancel the submission. To cancel, return `true`.|
4242
| onSubmitted | (listItemData: any, listItem?: IItem) => void | no | Method that returns listItem data JSON object and PnPJS list item instance (`IItem`). |
4343
| onSubmitError | (listItemData: any, error: Error) => void | no | Handler of submission error. |
4444
| onCancelled | () => void | no | Handler when form has been cancelled. |

0 commit comments

Comments
 (0)