Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Boolean property editor default value not set when content is created using ContentService #8418

Closed
OnlinePseudonym opened this issue Jul 10, 2020 · 1 comment

Comments

@OnlinePseudonym
Copy link

Umbraco version

I am seeing this issue on Umbraco version: 8.6.3

Bug summary

When creating a node using the ContentService the default value of the boolean property editor isn't applied.

Specifics

When content is created in the back end the values for the boolean property editor are empty. Content created in the front end sees no value on the model and applies the default based on the config but content created in the back end never sees the angular controller.

Since the angular controller is setting the value of the property editor when the content is loaded it appears as if the default value is set to True (the checkbox is checked and there is no green + icon indicating a saved draft) but until you save and publish from the content tree the value is still empty and rendered as false in views.

I created a forum post when I first came across it with images of what I was experiencing but after looking into it a bit more I think it's a bug.

This seems related to #6252 but occuring when content is created in the back end not when a property editor is added to existing content.

Steps to reproduce

  • Create a document type with an Umbraco.TrueFalse property editor and set the default value to true.
  • Create a new IContent node of your document type using the Create method of the ContentService.
  • SaveAndPublish created node

Expected result

I expected the default values to be set, if not possible I'd expect the content in the back office to reflect the value that's rendered to views.

Actual result

No values were set but the created node in the content tree appears to set up correctly.

@nul800sebastiaan
Copy link
Member

Yeah so this is how it works - setting "default value" to "true" only tells the AngularJs when the page loads: if this checkbox has no value (null), then set it to true in the UI.

Indeed, this default value is not wired up in the ContentService which could be considered a bug. However, this setting was really not implemented in the way we would like it to be implemented (and we would like to have a better way to be able to set "default" or "initial" values for all property editors where it makes sense (#7859). So for now: you are responsible for setting the default to true yourself if you create items using the ContentService and in the future we hopefully have a robust system for doing this automatically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants