Skip to content

Commit 584b06c

Browse files
authored
DynamicForm - disable save button (#1810)
* enable/disable save button * update documentation --------- Co-authored-by: matteo <>
1 parent a1270d0 commit 584b06c

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

docs/documentation/docs/controls/DynamicForm.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ The `DynamicForm` can be configured with the following properties:
6161
| webAbsoluteUrl | string | no | Absolute Web Url of target site (user requires permissions). |
6262
| fieldOverrides | {[columnInternalName: string] : {(fieldProperties: IDynamicFieldProps): React.ReactElement\<IDynamicFieldProps\>}} | no | Key value pair for fields you want to override. Key is the internal field name, value is the function to be called for the custom element to render. |
6363
| respectEtag | boolean | no | Specifies if the form should respect the ETag of the item. Default - `true` |
64+
| saveDisabled | boolean | no | Specifies if save button is disabled. |
6465
| validationErrorDialogProps | IValidationErrorDialogProps | no | Specifies validation error dialog properties |
6566
| customIcons | { [ columnInternalName: string ]: string } | no | Specifies custom icons for the form. The key of this dictionary is the column internal name, the value is the Fluent UI icon name. |
6667

src/controls/dynamicForm/DynamicForm.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ export class DynamicForm extends React.Component<
221221
{!this.props.disabled && (
222222
<Stack className={styles.buttons} horizontal tokens={stackTokens}>
223223
<PrimaryButton
224-
disabled={isSaving}
224+
disabled={this.props.saveDisabled || isSaving}
225225
text={strings.Save}
226226
onClick={() => this.onSubmitClick()}
227227
/>
@@ -418,7 +418,7 @@ export class DynamicForm extends React.Component<
418418
if (field.newValue !== null && field.newValue !== undefined) {
419419

420420
let value = field.newValue;
421-
421+
422422
if (["Lookup", "LookupMulti", "User", "UserMulti", "TaxonomyFieldTypeMulti"].indexOf(fieldType) < 0) {
423423
objects[columnInternalName] = value;
424424
}

src/controls/dynamicForm/IDynamicFormProps.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ export interface IDynamicFormProps {
1313
* Specifies if the form is disabled
1414
*/
1515
disabled?: boolean;
16+
/**
17+
* Specify if save button is disabled.
18+
*/
19+
saveDisabled?: boolean;
1620
/**
1721
* List id
1822
*/

0 commit comments

Comments
 (0)