And if it’s not supported out of the box, is there a way to inject custom JS/HTML to a model page or a model field UI? to achieve this behavior manually.
Could you please provide some more details about your use case :
Which agent version/stack are you running ?
What do you want to achieve here ?
Why do you need to perform this kind of validation in the frontend ?
Is the field length already validated by your database/orm ?
I will clarify: I don’t want to make any kind of validation, I just want to show the user - the current length of the input text, so it will help him to not get an error when he tries to save the field.
So if i could add some counter UI near the field input manually (through custom JS) or not manually it can be great.
Thanks for the clarification. This feature is not available on Forest Admin for the moment. If this info is very important to you, I suggest defining a smart action to edit this field.
With smart action fields and change hooks, you are able to show a read only field showing any dynamic info about what people typed in the form.
Thanks for the reply, I will check Smart Actions.
Another question, is it possible to cut the input text at some pre-defined length? I mean like defining max length on the input.
The Input widget does not allow to configure a max length, but as @GuillaumeGautreau mentioned you could make use of smart actions to allow your collaborators to edit the field.
When using smart actions you can either update the value of the input using hooks while the user is interacting with it or simply truncate the input at your desired length after the form has been submitted.