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

[SelectField] "onChange" event doesn't pass enough parameters #1193

Closed
iamzhouyi opened this issue Jul 17, 2015 · 3 comments
Closed

[SelectField] "onChange" event doesn't pass enough parameters #1193

iamzhouyi opened this issue Jul 17, 2015 · 3 comments
Labels
component: select This is the name of the generic UI component, not the React module!

Comments

@iamzhouyi
Copy link

When I use SelectField componect the callback "onChange" only pass through the event object.
It makes sense to know the which item is selected.

Here is a piece of source code in select-field.jsx

onChange(e, index, payload) {
if (payload) {
e.target.value = payload[this.props.valueMember] || payload;
}
if (this.props.onChange) {
this.props.onChange(e);
}
}

I think it should be a missing to forget to pass "index" to onChange

@oliviertassinari
Copy link
Member

You can use event.target.value. See https://facebook.github.io/react/docs/forms.html.

hai-cea added a commit that referenced this issue Jul 17, 2015
to pass through enough parameters to onChange.  see  #1193
@hai-cea
Copy link
Member

hai-cea commented Jul 17, 2015

Fixed with #1194

@hai-cea hai-cea closed this as completed Jul 17, 2015
JAStanton pushed a commit to convoyinc/material-ui that referenced this issue Jul 30, 2015
@Muneem
Copy link

Muneem commented Nov 25, 2016

How to pass more parameters in onchange? Whats the syntax?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: select This is the name of the generic UI component, not the React module!
Projects
None yet
Development

No branches or pull requests

5 participants