Add characters counter on a field model

Hi, is there a way to add a characters counter text on to a model field?
This is my field:

      description: {
        type: DataTypes.STRING,
        defaultValue: '',
        validate: {
          len: [0, 160],

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.


Hello @Sagi, and welcome back to the community.

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 ?

Thanks for your input :pray:

Nicolas Moreau

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.


  • Agent (forest package) name & version: “forest-express-sequelize”: “^9.2.9”, “forest-cli”: “^4.1.3”, (nodejs )“engine_version”: “18.16.0”
  • Database type: Postgres

Hello @Sagi,

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.

I’ll add your suggestion to our product board.

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.

Hello @Sagi,

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.

Best regards,