Your TEXT-BOX-INPUT-ELMENT, which takes the input from your user in form of text, has a—> LENGTH <—, which changes with every typed in LETTER into the box.
So, what do you need, to solve your issue?
- A Text-Inputbox with a specific ID or your page.
- A text placed somewhere on your page (for example under your Tex-Input), which will show us the already used number of allowed letter-count.
- You can even generate a second text-element under the first text-element, to be able to show the remaining letters the user still can use, until the counters falls to 0 → 0-remaining letters to be used…sorry…
What else do we need?
Yes! Of course we will need some ----> CODE !!!
Let’s start our coding adventures…
- We start when page is ready…
$w.onReady(()=>{..........});
- We want to see changes only when the INPUT-BOX changes it’s value…
$w.onReady(()=>{
$w('#textInputBoxIDhere').onChange(()=>{
});
});
- What do we want to change? → our two other text-elements right?
Let’s call them -->text1<-- and -->text2<–
$w.onReady(()=>{
$w('#textInputBoxIDhere').onChange(()=>{
$w('#text1').value = "?????????"
$w('#text2').value = "?????????"
});
});
What do you have to do here???
And what else do you have to know first???
Maybe, you want first to know the length of the already typed in text into your Text-Input-Box???
Let’s get it first —>
$w.onReady(()=>{
$w('#textInputBoxIDhere').onChange(()=>{
let currentTextLenght = $w('#textInputBoxIDhere').lenght
//....or.....
let currentTextLenght = $w('#textInputBoxIDhere').value.lenght
$w('#text1').value = "?????????"
$w('#text2').value = "?????????"
});
});
Try out which works which not, i am not sure.
Once you know how long your already typed in text-length is, what to do next?
Maybe come calculations? But what to calculate?
Oh of course → you already know a further variable, called …
txtMaxLengthBox1 = 700;
…and …
txtMaxLengthBox2 = 1900;
What to calculate now?
$w.onReady(()=>{
let txtMaxLengthBox1 = 700;
let txtMaxLengthBox2 = 1900;
$w('#textInputBoxIDhere').onChange(()=>{
let currentTextLenght = $w('#textInputBoxIDhere').lenght
//....or.....
let currentTextLenght = $w('#textInputBoxIDhere').value.lenght
$w('#text1').value = "?????????"
$w('#text2').value = "?????????"
});
});
CONTINUE…
