From d5d744b3e087ad4b81c0a0d113c368a37a1849d0 Mon Sep 17 00:00:00 2001 From: Kruger77 <58533713+Kruger77@users.noreply.github.com> Date: Mon, 12 Feb 2024 07:33:33 +0100 Subject: [PATCH] Update with limit text example.md a simple example who shows how to limit the text for the Text Input OBJ --- docs/gdevelop5/objects/text_input/index.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/gdevelop5/objects/text_input/index.md b/docs/gdevelop5/objects/text_input/index.md index 12516a78d6..e0f4f48911 100644 --- a/docs/gdevelop5/objects/text_input/index.md +++ b/docs/gdevelop5/objects/text_input/index.md @@ -46,3 +46,11 @@ You can set, either from the object properties or using actions, the field as : * Read-only. Text can still be selected and usually the appearance of the field does not change, but the text can't be modified. * Disabled. Text usually can't be selected, nor modified, and some devices or platforms will gray the input. + +## Limit the text the user can write + +You can limit the characters in a text input field by setting a maximum number of characters allowed for input. This is typically achieved by implementing a condition that checks the length of the input text against the specified limit, preventing further input when the limit is reached. + +You can limit the text input using the following expression: ***StrLength(TextInput.Text()) < [numeric_variable]***. +![TextInputExample](https://github.com/GDevelopApp/GDevelop-documentation/assets/58533713/10266e06-f7a4-4cd1-bfc0-14eec04f0825) +