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

Content: Item Cannot Be Saved if the Number Field has a Default Value of 0 #3154

Open
Tracked by #3152
zcolah opened this issue Jan 22, 2025 · 2 comments
Open
Tracked by #3152
Assignees
Labels
question Further information is requested

Comments

@zcolah
Copy link

zcolah commented Jan 22, 2025

Problem:
If I increased and then decreased back to 0 it let me save the field.
A user set a number field as required and with a default value of 0. However when they tried to save the variant it treated the 0 as a missing required field and threw an error and did not allow the user to save the content item/

Solution:
The user should be able to save the item, as the number field technically had a value aka 0. They do not need to manually re-enter 0 for it to save.

@finnar-bin
Copy link
Contributor

@zcolah based on my investigation any default value does not get applied to an automatically generated content item during the creation of a new single page model. This is because in the current workflow when creating a new single page model, it immediately creates a content item as soon as the user clicks the create model button. So, when the user then adds fields with default values, that automatically generated content item will not have the default values. I would like to make it very clear that this only happens for automatically generated content items during the creation of a new single page model, if the user tries to make a new content item the default values will be applied.

I am not sure if the original design for the field default value is for it to only be applied when creating a new content item but a possible solution to this that I could think of is when the user opens a content item, check each field's value, if it is currently null (which means they haven't modified that field's value yet) and there's a default value set, then apply that default value to the empty field.

There are some caveats for the proposed solution above though

  1. Would we want to automatically fill up empty fields with their default values for all content items? If we only want to do it for the automatically generated content item, it would be kind of difficult to determine which content item was automatically generated since the api does not tell me which content was automatically generated.
  2. I guess this goes without saying but automatically filling up empty fields with default values would trigger a dirty state for said content item since they'll need to manually save.
  3. If we do decide on doing this for all content items, it may potentially cause some confusion if they open up a content item and expect for example a text field to be empty then all of a sudden we auto populate it with the default value.

@finnar-bin finnar-bin added the question Further information is requested label Jan 30, 2025
@zcolah
Copy link
Author

zcolah commented Jan 30, 2025

If this were a critical issue, it would likely have been raised by now. While it is a valid concern, it’s important to note that the system is not breaking or corrupting data and is operating within its defined rules. When the content item is created, it starts without fields, so no default values are populated.

For now, we can leave the system as is until a user request or issue arises. I don’t believe any organization would create a single-page model and expect the first auto generated item to be populated with default values.

Typically, the developer sets up the model, codes the template, inputs the initial version of the content, and then hands it over to the marketing team.

Hence lets de prioritize this.

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

Successfully merging a pull request may close this issue.

2 participants