You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create a trivial custom block, do not define a block component attribute so that in the manager adding the block displays the fields. Add this field to the block.
[StringFieldSettings(DefaultValue="Some Value")]
public StringField SomeField { get; set; }
The default value is not displayed in the manager when adding the block to a page, nor is the default value applied to the field when the block is rendered in the page in preview.
Attempting to create a workaround using the following.
public void InitManager()
{
if (SomeStringField.Value == null)
{
SomeStringField = "Some Value";
}
}
The default value is not dispayed in the editor when the block is first added to the page, but it is displayed after adding it if the page is closed and then reopened in the editor.
So I haven't yet found a workaround for initializing a field with a default value that is shown to the user when the block is added to a page.
The text was updated successfully, but these errors were encountered:
I think the default value was actually removed from the implementation at the last minute as there was no way to determine if the field (and model) was actually new, or if the user has deliberately cleared the value of the field. If I remember correctly we removed it to discuss if this behavior was ok, and then it never got added back into the manager.
Create a trivial custom block, do not define a block component attribute so that in the manager adding the block displays the fields. Add this field to the block.
The default value is not displayed in the manager when adding the block to a page, nor is the default value applied to the field when the block is rendered in the page in preview.
Attempting to create a workaround using the following.
The default value is not dispayed in the editor when the block is first added to the page, but it is displayed after adding it if the page is closed and then reopened in the editor.
So I haven't yet found a workaround for initializing a field with a default value that is shown to the user when the block is added to a page.
The text was updated successfully, but these errors were encountered: