Skip to content

Commit

Permalink
Update Form.tsx and make submit method public (rjsf-team#4029)
Browse files Browse the repository at this point in the history
* Update Form.tsx and make submit method public

* Update Form.tsx and make submit public

* Update CHANGELOG.md and add an entry for submit method changes

* Update CHANGELOG.md

---------

Co-authored-by: Heath C <51679588+heath-freenome@users.noreply.github.com>
  • Loading branch information
popmanhe and heath-freenome committed Jan 8, 2024
1 parent db146ff commit 8c685b7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ should change the heading of the (upcoming) version to include a major version b
## @rjsf/core

- Removed `dateElementProps` function implementation, and replaced it with `getDateElementProps` from `@rjsf/utils`.
- Modify submit method to make it a public method, fixing [#4015](https://github.com/rjsf-team/react-jsonschema-form/issues/4015)

## @rjsf/antd

Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/components/Form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,7 @@ export default class Form<
}

/** Provides a function that can be used to programmatically submit the `Form` */
submit() {
submit = () => {
if (this.formElement.current) {
this.formElement.current.dispatchEvent(
new CustomEvent('submit', {
Expand All @@ -751,7 +751,7 @@ export default class Form<
);
this.formElement.current.requestSubmit();
}
}
};

/** Attempts to focus on the field associated with the `error`. Uses the `property` field to compute path of the error
* field, then, using the `idPrefix` and `idSeparator` converts that path into an id. Then the input element with that
Expand Down

0 comments on commit 8c685b7

Please sign in to comment.