How restricting the number of characters in a input text box?

Every time the user changes something in the text box it checks if the length of the text is greater then or equal to 5, if it is chop 1 from the left and set the text in the text box. This limits it to 4 characters in said text box.

Edit: I’m pretty sure with this way you could bypass the limit by simply copying in text instead. So you should take the maximum limit - the length of the text > absolute > clamp 1-X and plug that into the “Left Chop” nodes count, that way even if you copy something it should chop it off to the maximum limit.

Edit2: Something like this would work.

11 Likes