Copy link to clipboard
Copied
What do I need to do to get only 1 letter written?
What should I do to switch to the next box after typing?
that's my error. focusA != this.focusA, so
for(var i=0;i<focusA.length;i++){
should be
for(var i=0;i<this.focusA.length;i++){
Copy link to clipboard
Copied
what determines the end of typing? (eg, the enter key press)
what's the instance name of the "next" textfield?
are those dynamic textfields?
are you listening for keyboard events and then adding text using js?
Copy link to clipboard
Copied
No problem thanks,
but What do I need to do to get only 1 letter written?
(textinput)
Copy link to clipboard
Copied
that's a mistake. (using a textinput component.) as mentioned before you should be using a dynamic textfield.
but if that's what you want, this will do what you want and set you up to continue to the next problem:
this.focusA = [];
document.addEventListener('keyup', f.bind(this));
function drawEndF(){
this.focusA.push(document.getElementById("ti_1")); // where ti_1 is a text input component. you'll want to loop through them all here
}
stage.on("drawend", drawEndF, this, true);
function f(e){
for(var i=0;i<focusA.length;i++){
if(this.focusA[i] == document.activeElement){
this.focusA[i].value = this.focusA[i].value.slice(-1);
}
}
}
Copy link to clipboard
Copied
>function f(e)
I, for one, appreciate the use of descriptive function names here. So many people write code with cryptic function names that can make the intent of code hard to follow.
Copy link to clipboard
Copied
@ClayUUID, just for you:
this.focusA = [];
document.addEventListener('keyup', keyUpF.bind(this));
function drawEndF(){
this.focusA.push(document.getElementById("ti_1")); // where ti_1 is a text input component. you'll want to loop through them all here
}
stage.on("drawend", drawEndF, this, true);
function keyUpF(e){
for(var i=0;i<focusA.length;i++){
if(this.focusA[i] == document.activeElement){
this.focusA[i].value = this.focusA[i].value.slice(-1);
}
}
}
Copy link to clipboard
Copied
Is this the only place I would name the code based on my project? because i am getting error
Copy link to clipboard
Copied
that's my error. focusA != this.focusA, so
for(var i=0;i<focusA.length;i++){
should be
for(var i=0;i<this.focusA.length;i++){