用户在FormControl中输入文本字符串,我想把它修剪掉并且更低。
handleSubmit(event) {
event.preventDefault();
console.log("submitted: "+ this.vehicleReg.value.trim().toLowerCase());
this.refs.vehicleReg.value=this.vehicleReg.value.trim().toLowerCase();
}
render() {
return(
<form className="user-data" onSubmit={this.handleSubmit.bind(this)}>
<FormGroup label="Data">
<FormControl
inputRef={(input) => this.vehicleReg = input} type="text"
placeholder="Reg Number"
答案 0 :(得分:0)
为FormControl
添加名称属性,然后在handleSubmit
document.querySelector('[name="regNum"]').value = document.querySelector('[name="regNum"]').value.trim().toLowerCase();