【发布时间】:2014-09-12 10:53:01
【问题描述】:
我正在尝试创建一个密码确认功能,该功能仅在用户离开确认字段后才呈现错误。我正在使用 Facebook 的 React JS。这是我的输入组件:
<input
type="password"
placeholder="Password (confirm)"
valueLink={this.linkState('password2')}
onBlur={this.renderPasswordConfirmError()}
/>
这是 renderPasswordConfirmError :
renderPasswordConfirmError: function() {
if (this.state.password !== this.state.password2) {
return (
<div>
<label className="error">Please enter the same password again.</label>
</div>
);
}
return null;
},
当我运行该页面时,输入有冲突的密码时不会显示该消息。
【问题讨论】:
标签: html reactjs reactive-programming react-jsx onblur