Issue #772💬 AnsweredOpened January 17, 2018by krunal0391 reactions

Trait validation

Quick answerby ryandeba1

Hi @krunal039, The only way I know to do something like would be to make a custom trait and use the getInputEl function to either set a maxlength property on your input or create a section show whatever errors that you want.

Read full answer below ↓

Question

Is there way to restrict trait length i.e title cannot be more than 255 chars and if user try to add more than that, should display error message?

Answers (3)

ryandebaJanuary 18, 2018

Hi @krunal039,

The only way I know to do something like would be to make a custom trait and use the getInputEl function to either set a maxlength property on your input or create a section show whatever errors that you want.

artfJanuary 18, 2018

The only way I know to do something like would be to make a custom trait

Correct

krunal039January 19, 2018

@ryandeba @artf , thanks for reply, is there way to pass property(max length, validation error message) to custom traits?

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Free option

Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.

Browse free plugins →
Premium option

Premium plugins ship with support, regular updates, and production-ready features — save days of integration work.

Browse premium plugins →

Related tutorials

In-depth guides on the same topic.

All tutorials →

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.