Hello,
thank you for your replies. Unfortunately, there are no errors. I can see that something changes but within milliseconds it changes to the old value.
I don`t want to share the public development URL in public but if it helps, I can share it to you via PM. Nevertheless, I will share here some code snippets for a better understanding:
My View:
onKeyUp(event) : void {
let oldValue = this.token.value;
let value = event.target.value.toUpperCase();
// check if needs to add or replace a seperator (-) for Format de305d54-75b4-431b-adb2-eb6b9e546014
var start = 0;
BLOCK_LENGTHS.forEach(function(blockLength, index) {
start += blockLength;
if (value.length >= start) {
let lastBlockChar = value.substr(start - 1, 1);
let sep = value.substr(start, 1);
// case 1: last block char is separator due to deleting last block character => remove it!
if (lastBlockChar === SEP) {
value = value.substring(0, start-1) + value.substr(start);
}
// case 2: add a last block character => add seperator
else if (value.length === start && index !== BLOCK_LENGTHS.length-1) {
// check also if user does not want to drop the separator
if (value.length >= oldValue.length)
value += SEP;
}
}
start++; // add seperator length
});
this.token.updateValue(value.substr(0, start-1), {onlySelf:true, emitEvent:true});
this.token.markAsDirty(true);
}
static tokenValidator(control) {
// de305d54-75b4-431b-adb2-eb6b9e546014
let value, re;
let start = 0;
let output = null;
for (let index = 0; index < BLOCK_LENGTHS.length; index++) {
let blockLength = BLOCK_LENGTHS[index];
value = control.value.substr(start, blockLength);
re = new RegExp(`^[A-Fa-f0-9]{${blockLength}}$`, '');
if (!value.match(re)) {
output = {};
output[`invalid_block_${index+1}`] = true;
break;
}
start += blockLength+1;
}
return output;
}
The functionality of onKeyUp is quite simple: it enforces uppercase characters and a separation “-” to structure the UUIDv4 format (e.g. XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX). In a desktop browser this “hack” of rewrite works but in Android it works only if I press the enter button. When I write for example an “a”, it changes the example to “A” but within seconds it changes it again back to “a”.
I hope I could illustrate my problem and hope you can give me a hint to solve this problem