Custom validation settings on fields?

It would be great if there was a custom validation feature available.

Something like the UID validation, but letting us choose what happens.

image

Some examples:

Hey Max,

This is something we’ve thought long and hard about. We’ve also discussed it at length in this blog post:
https://prismic.io/blog/required-fields

We’re very open to discussing this and especially the other suggested solutions that we talked about in the article including:

  • Completely removing null value (plus replacing them by default values)
  • Pre-fill a new document with all default values.
  • Empty document preview
  • Warning at first publication: Avoid empty fields, mostly for SEO

Please read the article in depth so we can discuss easier the pain points and possible solutions when for implementing of a feature like this :grinning:

Thanks.

Thanks Phil, that is an interesting read. And it also sounds like quite a can of worms! :bug:

I agree that text defaults would be bad for content editors who want to use live preview, so I can understand that isn’t something that would be implemented.

However, default labels (which is my use-case specifically) seems fairly innocuous - though maybe that would lead down a slippery slope of “I can have a default label, why not default text?”

What do you think about maximum and minimum length warnings? Something like the UI being orange around a field, or something. That could be used to indicate fields that probably should be default. (And provide guidance for SEO fields).

I suppose it’s a case of me thinking I have a perfectly reasonable use-case - I’m not going to smack ‘required’ on every single field - but once it is possible, people will, and that will be nasty.

1 Like

Hi Phil,

One of the items that Marcello mentioned which would be quite useful is just having a field length. It wouldn’t have to be a validation and wouldn’t have to prevent publishing but it would be nice if we could set guidelines so content editors can see they have gone over the defined limit by highlighting the field as they edit.

Is this something that could be considered?

3 Likes

Hi Jaie,

Welcome to the community!

I really like that idea, I’ve added it to the request tracker and I’m going to bring it up in person with the features team.

Obviously though this isn’t something that we are working on at the minute. If/when this changes we’ll update you here.

Thanks.

1 Like

Usecase 1
A lot of time the frontend is designed to only accommodate only a certain number of characters. This is where having a min and max limits helps a lot.

Usecase 2
Helps a lot with Metatags. Typically description metatag can only have a limited number of characters being shown in Google serp. Show need to limit the number of characters the creator enters.

Hey Shyamal,

I think these are really strong use cases, especially the second one concerning the descriptions metatag. I've added both of them to the Productboard for the team to see.

If the product team needs more information they'll reach out here.

Thanks.

This is being tracked as an open feature request.

If you have another use-case for this feature, you can 'Flag' this topic to reopen. Please use the :heart: button to show your support for the feature and check out our Feature Request Guidelines.