Commit 45828e06 authored by Steffen Michels's avatar Steffen Michels

use 'input' instead of 'keyup' event to generate events for form UI...

use 'input' instead of 'keyup' event to generate events for form UI components; this prevents missed inputs by right mouse click -> paste/cut
parent 232d9393
Pipeline #20002 passed with stage
in 4 minutes and 43 seconds
......@@ -13,7 +13,7 @@ itasks.TextField = {
if('enabled' in me.attributes && me.attributes['enabled'] === false) {
el.disabled = true;
} else {
el.addEventListener('keyup',function(e) {
el.addEventListener('input',function(e) {
const rawV = e.target.value;
var v = Just(rawV);
if('maxlength' in me.attributes){
......@@ -24,8 +24,8 @@ itasks.TextField = {
return;
}
}
if('minlength' in me.attributes){
if(rawV.length < me.attributes['minlength']){
v = Nothing;
}
......@@ -60,7 +60,7 @@ itasks.TextArea = {
if('enabled' in me.attributes && me.attributes['enabled'] === false) {
el.disabled = true;
} else {
el.addEventListener('keyup',function(e) {
el.addEventListener('input',function(e) {
const rawV = e.target.value;
var v = Just(rawV);
if('maxlength' in me.attributes){
......@@ -105,7 +105,7 @@ itasks.PasswordField = {
if('enabled' in me.attributes && me.attributes['enabled'] === false) {
el.disabled = true;
} else {
el.addEventListener('keyup',function(e) {
el.addEventListener('input',function(e) {
const rawV = e.target.value;
var v = Just(e.target.value);
if('maxlength' in me.attributes){
......@@ -152,7 +152,7 @@ itasks.NumberField = {
if('enabled' in me.attributes && me.attributes['enabled'] === false) {
el.disabled = true;
} else {
el.addEventListener('keyup',function(e) {
el.addEventListener('input',function(e) {
var value = e.target.value == "" ? NaN : Number(e.target.value);
const isFloat = value % 1 !== 0;
value = (isNaN(value) || (!me.allowDecimal && isFloat)) ? Nothing : Just(value);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment