How to avoid special characters on input text

Hi team,

On of my users input one special character at the end of a phone number input text field.
the phone number was followed by the character whose decimal ascii code is: 8236 (or \u202c)

This character is not visible on the screen and we took a long time to find out where the issue was coming from.

Is is possible to restrict the input to avoid these kind of problems?
What is your recommandation?
Does it need to be fixed from our side (with some kind of hook)?
Should that been fixed on your side?
Would there be a way to limit the input with some set up?

Thanks in advance for your help.

My current set up:

    "database_type": "postgres",
    "liana": "forest-express-sequelize",
    "liana_version": "6.6.3",
    "engine": "nodejs",
    "engine_version": "12.13.1",
    "orm_version": "5.22.3"
1 Like

Hi @Louis-Marie :wave:t3:

You can add a validation at the model level to control user input and return errors in the create or update views. Check out our docs - here :books:

:information_source: Sequelize integrates nicely with validator.js library which has a pre-set of validators. Check out their docs - here :books:. You can also write your custom validator method in your model and return custom error messages.

Let me know if this helps :pray:t3:

1 Like

Hi @ziad

That’s perfect.

Thank you very much for your help.

Best regards and Happy new year! :tada:

1 Like

Thanks! Happy new year to you too :balloon:
Let’s hear from you in the community in 2021!