How do I save a value that is a zero (integer) in a field without typing it twice?

I have a property, ourScore that is supposed to be an int. Think of a score in a game of hockey for example:

With following settings:

When the editor creates this document the score should be zero to start with.

Great!
However if one tries to publish this, you can’t:

Using the DeliveryApiExtensions I can already here preview what I get via the content delivery API:
"ourScore": null

So this makes sense, you can’t publish it if it doesn’t validate (I wish Umbraco would say which value is incorrect but that’s for future updates I hope).

However.. if I erase that 0 and then type in a new 0 and save, it is:
"ourScore":0

And the document can be published.

Is there any way to force the zero to be a real zero value?
Removing the validation just hides the problem and you end up with null values where there should be a true zero value.

Only solution I can think of is a ContentSavingNotification that transforms null values on these fields to a true zero. Is there any smoother solution?

I would create a bug report, sound like a bug to me.

Having said that, for now, the ContentSavingNotification is quite an elegant solution in my opinion.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.