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

FormDataConsumer is not working with custom form name #2429

Closed
ashim-kr-saha opened this issue Oct 14, 2018 · 1 comment
Closed

FormDataConsumer is not working with custom form name #2429

ashim-kr-saha opened this issue Oct 14, 2018 · 1 comment
Assignees
Labels

Comments

@ashim-kr-saha
Copy link
Contributor

What you were expecting:
FormDataConsumer should provide form data object with custom from name or where form name is not record-form.

What happened instead:
Returns an empty object.

Steps to reproduce:
Give custom form name inside TabbedForm

Related code:

class VoucherCreate extends Component {
  render() {
    return (
      <Create title="Voucher" {...this.props}>
        <TabbedForm form="my-custom-form-name">
          <FormTab label="Details">
            <TextInput source="voucher_no" />
            <ReferenceInput
              source="student_id"
              reference="students"
              perPage={5}
            >
              <AutocompleteInput optionText="name" />
            </ReferenceInput>
            <FormDataConsumer>
              {({formData, ...rest}) =>{
                console.log(formData); // Should print the form data
              }
            </FormDataConsumer>
          </FormTab>
        </TabbedForm>
      </Create>
    );
  }
}

Environment

  • React-admin version: 2.3.4
  • Last version that did not exhibit the issue (if applicable): N/A
  • React version: 16.3.2
  • Browser: Chrome
@fzaninotto
Copy link
Member

Thanks for the report. That's feasible using redux-form's FormName component.

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

No branches or pull requests

2 participants