![](/img/trans.png)
[英]Unable set the limit of visible options in the dropdown of a select input type
[英]Unable to choose other options in <select>, however the list of options are visible on dropdown…
在这里,我正在向服务器发出表单值,目前可以正常工作。但是,除了默认选项外,我无法从选择输入中选择其他值...请帮助!
var Query = React.createClass({
getInitialState(){
return{
value:'Sunday'
}
},
change(e){
this.setState({value: e.target.value});
},
join() {
var memberName = React.findDOMNode(this.refs.name).value;
var dayz = React.findDOMNode(this.refs.day).value;
//emits name and day to the server....
this.props.emit('join',{ name: memberName, day: dayz });
},
render(){
return(
<div>
<form action="javascript:void(0)" onSubmit={this.join}>
<input ref="name" type="text" required/>
//unable to select other options apart the first (sunday => Wow)
<select ref="day" onChange={this.Change} value={this.state.value}>
<option value="sunday">Wow</option>
<option value="a">ssd</option>
<option value="Java">Java</option>
<option value="C++">C++</option>
</select>
<button>Join</button>
</form>
</div>
);
}
});
module.exports = Query;
<select>
有一个错字:它的大写字母“ C”而不是小写的“ c”(如函数名称一样)。 更新this.Change
到this.change
。
<select ref="day" onChange={this.change} value={this.state.value}>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.