0

what would be the best solution when trying to paste a string that is longer than the maximum allowed number of characters in a text field: Truncate the string in the clipboard or not pasting at all? There is no explicit number of max characters indicated in the field, but it follows a standard.

So, let's say I want to paste THISTEXT in a 4 character limited text field.

Should I paste THIS or should I not paste anything at all.

Another case could be if the text field already has something on it, for example "IS". Should then the resulting of pasting THISTEXT there be "ISTH" or just keep "IS"

Thanks!

2
  • 1
    Are these the only options? What about allowing the whole string to be pasted, but not saved until the user edits the string down to size? (I.E as per Twitter)
    – JonW
    Commented Sep 7, 2018 at 10:58
  • Or as when composing comments on StackExchange. It could depend on the sort of thing you are pasting into, but being able to selectively delete a too-long string, instead of being forced to paste it elsewhere, edit, then copy-paste would be a distinct advantage.
    – TripeHound
    Commented Nov 8, 2018 at 16:21

2 Answers 2

1

The user has copied text and is trying to use it in your app. When the text doesn't work the user is going to have a bad experience. Your app should do whatever it can to help the user correct the problem as easily and quickly as possible.

Your app should notify them of the issue, give instructions on how to correct it, and give them the best tool to edit the text possible.

Make the text input easy to edit and help the user edit the text they input.

It's the least effort both cognitively and physically for the user. Don't try to do anything to the text unless it always works on everything and is simple to understand. If it can take longer for the user to figure out what your app did than it does for the user to do it themselves, don't do it.

Here's an example of great error indicators for a text input from Material Design. Your app can try to help by suggesting solutions in the error messages.

enter image description here

From this page on text fields

1
  • Yup, show the entire pasted text and instantly show the error notification so the user is aware.
    – Nicolas
    Commented Nov 6, 2018 at 20:43
0

Of the two options offered, I would suggest not pasting and presenting the user with some messaging indicating why (e.g. "Not pasted because character count exceeds X").

If you go down the truncation path, it may not be clear to the user that not all of their clipboard has been pasted, or they may just assume it has (because copy & paste functions elsewhere usually include everything) and continue to the next field/task.

That all said, JonW's suggestion is a sound one and actually probably preferable to both.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.