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

onChange field id prop is undefined when user updates form #513

Open
ba11en opened this issue Oct 24, 2024 · 2 comments
Open

onChange field id prop is undefined when user updates form #513

ba11en opened this issue Oct 24, 2024 · 2 comments

Comments

@ba11en
Copy link

ba11en commented Oct 24, 2024

ive found an issue with the form's onChange event not giving the id of the field that the user changed.

this is working when running a RJSForm

component but not when i use it with and applyRules.

i know this package is not actively being worked on
but was hoping for clues to why this would not work, im happy to do a pr if its something that is definitely related to rjsf-conditionals and an easy enough fix

thanks again

edit: had a quick look at applyRules() and can see onChange gets handled locally,
then results are passed to the original onChange form prop
but omits the id prop

needs something like this i assume:

handleChange (formChange, id) {
    const { formData } = formChange;
    const { onChange } = this.props;
    if (!deepEquals(formData, this.state.formData)) {
      this.updateConf(formData, (newValues) => {
        if (onChange) {
          let updChange = Object.assign({}, formChange, newValues);
          onChange(updChange, id);
        }
      });
    } else {
      onChange && onChange(formChange, id);
    }
  }
@ba11en
Copy link
Author

ba11en commented Oct 24, 2024

tested this locally and its all good 👍
how do you want me to create a pr?
fork it, create a branch, then create pr?

@ba11en
Copy link
Author

ba11en commented Dec 16, 2024

fork has been created, please review and merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant