How to limit the input in the TextBox?

0 favourites
  • 3 posts
From the Asset Store
Forget about default textbox restrictions, you can create sprites atop of the textbox
  • Hello, does anybody knows how to limit the string or number input in the TextBox?

    (eg. Permit only the user to input two numbers maximum)

    I am also attaching a couple of images, since in Firefox the TextBox doesn't show some arrow controls on the right side. But in Google Chrome it does. Does this has to do with CSS styling?

    Anybody knows how to remove it, or the style options to do so?

    Firefox

    <img src="https://dl.dropbox.com/u/39300777/FAQs/Firefox.JPG" border="0" />

    Google Chrome

    <img src="https://dl.dropbox.com/u/39300777/FAQs/Chrome.JPG" border="0" />

  • first of all set textbox type to "text" NOT "textarea". text is single line, textarea is multiline - that's why you see these arrows.

    if you do this and arrows don't disappear you have to add css style overflow:hidden or overflow:auto

    as for the limit you can to id with events with compare two values system condition:

    len(TextBox.Text) > 2
    [ul]
    	[li]> TextBox set text to left(TextBox.Text,2)[/li]
    [/ul]
  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thank you for your answer ranma, trying it out.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)