How do I disable the backspace + delete keys in a textarea?

  • I'm making a simple a text editor that disables the backspace key for productivity reasons, and I'm not quite sure how to disable the backspace and delete keys.

    Can anyone point me in the right direction, please? I'm a complete noob. I have no idea what I'm doing.

  • it's not really a ''disable'' of sorts, since there does not appear to be an undo function by default, you could keep track of data entered in a variable on the OnChanged event, and when someone hits BackSpace or Delete revert the textbox to said variable?

    It's not pretty, but it might just work.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • So, you want the player to still enter text but not be able to delete the text?

  • len(x) - return length of the string x

    As Gumball said - make a variable to store the current state of the text box, only if the length of text is equal or greater than what it was previously.

    System Compare Two Values - len(TextBox) < len(TextVariable) - Set TextBox to TextVariable

    Else - Set TextVariable to TextBox

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