luci-base: cbi.js: recognize invalid input in dropdown create field
This is required to allow for validating the create field values in later commits. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
parent
c126c7349d
commit
0b6ae96f2d
1 changed files with 5 additions and 1 deletions
|
@ -2062,8 +2062,12 @@ function cbi_dropdown_init(sb) {
|
||||||
create.addEventListener('keydown', function(ev) {
|
create.addEventListener('keydown', function(ev) {
|
||||||
switch (ev.keyCode) {
|
switch (ev.keyCode) {
|
||||||
case 13:
|
case 13:
|
||||||
sbox.createItems(sb, this.value);
|
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
|
|
||||||
|
if (this.classList.contains('cbi-input-invalid'))
|
||||||
|
return;
|
||||||
|
|
||||||
|
sbox.createItems(sb, this.value);
|
||||||
this.value = '';
|
this.value = '';
|
||||||
this.blur();
|
this.blur();
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue