HOME DOCUMENTATION DOWNLOADS

Limiting Characters on input fields

Tags: #<Tag:0x00007fed762c7700> #<Tag:0x00007fed762c7610>

It is not apparent to the users if the character limit is reached in a field. They can keep entering as there is no limit to the number of characters that can be entered in a field. Only when saving the input text is shortened to the field’s character limit.

Would it be possible to “somehow” warn the user in such cases? or may be there is better solution

The text input should stop after reaching the limit.

Can you please attach how the field you describe is modelled? It already works on standard text boxes. Also – which browser are you testing it on?

The following field “Beginn” is modelled as memo field but the data length is set as 40. The UI allows more than 40 characters to be typed but once saved it truncates the content to 40 characters without any warning to the user. This is tested on Google Chrome.

BegnField


I think Memo fields are automatically nvarchar(max) (they used to be NTEXT. If you want limits you should actually use String data type.

But it should not truncate like you describe. We will have a look. As a workaround you can change data type to String and that will solve it.

@ptomask is it possible that the client truncates instead of stops user input if it is set to Memo?

Looks like the problem here is that the server sends MaxLength="-1" in the property definition in InitUi response. The truncation is done on the server after clicking on “Save”.

Does the server send -1 even thought it is set on 40 in the entity?

Anyway I think the biggest problem is that we allow to limit a length of a “memo” field. That makes no sense. Either it is String and then there is a limit OR it is Memo and then there is no limit.

I propose to make a model check that memo fields can never be limited.
@ramagumar does it make sense to you as well?