Hi there 👋
Here we can discuss new ideas, suggestions to make Typebot the best bot builder in town 😍
Changelog
Here we can discuss new ideas, suggestions to make Typebot the best bot builder in town 😍
Feedback
Here we can discuss new ideas, suggestions to make Typebot the best bot builder in town 😍
changed title from "Please let us limit the number of characters in a text field" to "Limit the number of characters in a text field"
I thought about this, but I couldn't find a legit use case. Why would you want to do that?
@baptistearno perhaps to prevent a user from entering more than necessary for a specific prompt. I would say, a response that should be just a sentence long (eg, if i were to ask for a short description of a subject and dont necessary want to read a longer response
Another example... typebot: Please enter your name -> User's response: Please can you help me to find where is blah blah blah...
Any update about this feature ?
Hello @art_n
Just add a SCRIPT before the textarea containing the following code:
That's it, where it says 100 (MAX_CARACTERES), change it to the number of characters you want.
const MAX_CARACTERES = 100;
setTimeout(() => {
const botBody = document.querySelector('typebot-standard')
.shadowRoot.querySelector('.typebot-container')
.querySelector('.typebot-chat-view');
const textArea = botBody.querySelector(
textarea
);textArea.maxLength = MAX_CARACTERES;
const textAreaContainer = textArea.parentElement;
textAreaContainer.style.position = 'relative';
const text = document.createElement('p');
text.innerText =
0 / ${MAX_CARACTERES}
;textAreaContainer.append(text);
text.style.cssText = 'position: absolute; right: 0; top: 100%;';
textArea.addEventListener('input', (e) => {
const textLength = e.target.value.length;
text.innerText =
${textLength} / ${MAX_CARACTERES}
;});
}, 500);