In Dynamics 365, when using the Web Client, when a field limit size is reached, the user will be prevented from typing in the field. This behavior is different in the Unified Interface. In this post, we will look at how to stop the user from continuing to enter in Unified Interface fields when the field size is reached.
Let’s start by creating a new field, called Field with Limit 10 Characters. This is a Single Line of Text field with a length of 10:
Now let’s add that to the Account form:
We can see the field in the web client. When we type, we cannot type more than 10 characters:
Now let’s open this in the Unified Client Interface. We can see we can type past 10 characters, and the UI will display a message “You have exceeded the maximum number of 10 characters in this field”:
To fix this so the field will stop allowing characters after 10, click on Change Properties:
Go to Controls tab. Click Add Control:
We will add an Input Mask control:
Select this as the default for Web, etc and click next to Mask:
Select Bind to a Static Value and enter all 10 0s. This means we are allowing 10 numeric characters:
Note you can also change the format as below:
0 – Digit 9 – Digit or space # – Digit, sign, or space L – Letter l – Letter or space A – Alphanumeric a – Alphanumeric or space < – Converts characters that follow to lowercase > – Converts characters that follow to uppercase | – Disables case conversion \ – Escapes any character, turning it into a literal All others – Literals
Now go to the UI form. You will see the field, with an underscore showing each character:
Enter in 1234567890. We are prevented from entering more characters:
Tabbing off the field, we see each character has an underscore. The presentation is different from the Web Client (which doesn’t show the underscore), however users will be prevented from typing over the field size.