<form onSubmit={this.submitHandler}>
submitHandler(e) {
e.preventDefault();
}
|
<ComboBoxComponent
id="customvalue"
ref={ComboBox => {
this.listObj = ComboBox;
}}
dataSource={this.searchData}
filtering={this.onFiltering.bind(this)}
allowFiltering={true}
fields={this.fields}
noRecordsTemplate={this.template}
created={this.created.bind(this)}
placeholder="Select a country"
popupHeight="270px"
/>
this.created = e => {
document
.getElementById("customvalues")
.addEventListener("keydown", function(keys) {
if (keys.key === "Enter" || keys.keyCode === 13) {
// Do something
keys.preventDefault();
}
});
};
|
<form id="form1">
<div>
<ComboBoxComponent id="games" dataSource={this.sportsData} allowFiltering={true} created={this.created.bind(this)} customValueSpecifier={this.customValue.bind(this)} ref={combobox => { this.listObj = combobox; }} fields={this.fields} placeholder="Select a game" value={this.value} popupHeight="220px" />
</div>
<div>
<button className="submit-btn e-btn" id="submit-btn">
Submit
</button>
</div>
</form>
this.isCustomValue = false;
this.customValue = e => {
this.isCustomValue = true;
};
this.created = e => {
var _this = this;
document.getElementById("form1").addEventListener("keydown", function(keys) {
if (keys.key === "Enter" || keys.keyCode === 13) {
if (_this.isCustomValue) {
keys.preventDefault();
_this.preventDefault = false;
}
}
});
}; |
|
|