Skip to content

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

@ba11en

Description

@ba11en

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);
    }
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions