Creating a default value to predefine checkbox items

Hi there,

I know that to predefine the checkbox items in a content model, I have to use validation - “Accept only specified values.” Is there a way to have a default value?


Hey @isha!

Unfortunately, it’s not available at the moment :disappointed: We do understand the need of that option and we already created a feature request for this.

Let me know if I can help you with anything else.

Hi @isha,

I have great news! Luckily, there is a workaround :metal:
Default values can be configured as follows:
You need to create a content type. Say, it’d be content type named person with fileds:

  • name
  • surname

Then you need to create another content type, say defaultperson with fields:

  • name
  • surname

The you create an entry of type defaultperson with EntryID default as follows:

“name”: “John”
“surname”: “Doe”

Then you need to write your custom application so that whenever there’s an entry of type person without name or surname it will use the values in the entry with EntryID default of type defaultperson.

That’s not something available out of the box via UI, it requires a bit of effort from your side, but I hope this approach could be helpful.

@andrey Thanks but that’s too much effort, glad to know you guys have a feature request open for default values. Please make sure it’s worded universally, not just for checkbox values, because we’ve run into cases like this:

User Groups: [many references]

  • Expected default: Array containing default value, Everyone [userGroup entry]

Radio buttons: default selection

Checkboxes: default selection(s)

Text fields: default string

… etc.

Just pointing out that this is a universal need! Thank you and we will use that feature the day you roll it out!


It’s been a year; does this exist yet?

1 Like

No updates in the product regarding this, but if @andrey’s answer doesn’t work, you can accomplish something similar with a UI extension. Basically you just need to check if the current value is '' (aka blank) and if so set the field to your default value.

I appreciate you’re suggestion; however that’s also not good workaround for us: we have a team of folks controlling our content, who should have the ability to decide what that default value is. Performing that check on the code-side/website-side pulls the ball out of their court and couples them to the developers whenever they need to update those default values. :no_good_man:t6:

With our new extension parameters you can have a per space or per field setting which can be easily changed in the Contentful web app that your extension can use as the default value for that field. It’s a brand new product release so please let us know what you think!

What all the UI Extension methods I’ve seen fail to address, is that the default value must be in sync with the field definition. If the field is a dropdown with a set of predefined values, the default value should of course be one of the listed values. This is best done by a control next to (or on) the list of values.
And if the field is a number or free text, you would want an easy way to enter the default, in the actual field edit dialog.

Is there an issue tracker somewhere, where we could upvote this feature request?