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

Handling form submits with Form component #4578

Closed
Orbyt opened this issue Jan 12, 2017 · 3 comments
Closed

Handling form submits with Form component #4578

Orbyt opened this issue Jan 12, 2017 · 3 comments
Labels

Comments

@Orbyt
Copy link

Orbyt commented Jan 12, 2017

I am unsure on how to do form validation with the antd <Form/> component found here. The documentation specifies an onSubmit prop on the <Form/> component, which is passed an event. It then seems to trigger a function inside this.props.form. I am currently using the following code:

handleSubmit(e) {
   e.preventDefault();

  console.log('before' + e.target.value)

  this.props.validateFields((err, values) => {
  console.log('errors: ' + err)
  console.log(values)
    if (!err) {
      console.log('Received values of form: ', values);
    }
  });
}

<Form inline onSubmit={this.handleSubmit.bind(this)}>
    ....
</Form>
  1. I am unable to retrieve values from the event passed into the submit callback, as e.target.value returns undefined.

  2. In the call to this.props.validateFields(), as shown in the documentation, where are these values coming from?

@benjycui
Copy link
Contributor

Ant Design team use GitHub issues to trace bugs or discuss plans of Ant Design. So, please don't ask usage questions here. You can try to ask questions in Stack Overflow or Segment Fault, then apply tag antd and react to your questions.

You should read documentation & FAQ and search issues before ask a question, THX!

It will be better if you read smart questions(提问的智慧).

@nkskalyan
Copy link

@Orbyt Did you get the issue fixed? or do you have a stackoverflow question for this issue?

@GeniousM
Copy link

@benjycui there is nothing useful answers in Stack overflow. and shut the fuck up the same replies to every questions of ant design MF. i can see you every git issue of ant design bullshit

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

4 participants