I have looked and tried the solutions from other questions, but I cannot seem to get it to work. The problem I am facing is that event.target.id and event.target.value do not work here. I have done some research and found out why. Now I just need a way to get the "id" from the selectfield
How do I grab the id, in order to make this function work?
Here I have the select:
<SelectField
id="category"
floatingLabelText="Category"
value={this.state.value}
onChange={this.updateTask.bind(this)}
>
<MenuItem disabled={true} primaryText="Choose A Category" />
<MenuItem value="delivery" primaryText="Delivery" />
<MenuItem value="dog walking" primaryText="Dog Walking" />
<MenuItem value="house cleaning" primaryText="House Cleaning" />
</SelectField>
And here is the function:
updateTask(event, index, value) {
event.preventDefault();
let updated = Object.assign({}, this.state.task);
updated[event.target.id] = event.target.value;
this.setState({
task: updated,
value: value,
});
}