Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Form.tsx and make submit method public #4029

Merged
merged 6 commits into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 methond and make it a public method.
heath-freenome marked this conversation as resolved.
Show resolved Hide resolved

## @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