Previously in Umbraco 8.x and Forms 8.x I was able to override default fieldtypes in Umbraco Forms.
I did this by inheriting for example the standard CheckBox type and changing the HideLabel property to true:
public class CheckBox : global::Umbraco.Forms.Core.Providers.FieldTypes.CheckBox
{
public CheckBox()
{
this.HideLabel = true;
}
}
I want to do the same in the new Umbraco 9.3.1 with Umbraco Forms 9.2.2 but it doesn't seem to pick up the changes that I make. I have tried the code shown above and also by overriding the hidelabel property like this
public override bool HideLabel => true;
However neither of these seem to be picked up. The code doesn't look to be executed. I checked this by editing the Name of the fieldtype, these changes aren't reflected in the backoffice either.
Has anyone tried this in Umbraco 9 and how did you solve this?
Hello, I was struggling with this in umbraco 10 but have figured it out.
You need to register your class the same way you'd register a new field see docs here
So it'd look something like this:
public class UmbracoFormsCustomProvidersComposer : IComposer
{
public void Compose(IUmbracoBuilder builder)
{
builder.WithCollectionBuilder<FieldCollectionBuilder>()
.Add<CheckBox>();
}
}
Hope this works for you if you've not already figured it out!
I totally forgot about updating this post myself, I had figured it out the same way you did and ended up adding an IComposer to add the Checkbox just like you!
Forms 9 overriding default fieldtypes
Previously in Umbraco 8.x and Forms 8.x I was able to override default fieldtypes in Umbraco Forms.
I did this by inheriting for example the standard CheckBox type and changing the HideLabel property to true:
I want to do the same in the new Umbraco 9.3.1 with Umbraco Forms 9.2.2 but it doesn't seem to pick up the changes that I make. I have tried the code shown above and also by overriding the hidelabel property like this
However neither of these seem to be picked up. The code doesn't look to be executed. I checked this by editing the Name of the fieldtype, these changes aren't reflected in the backoffice either.
Has anyone tried this in Umbraco 9 and how did you solve this?
Hello, I was struggling with this in umbraco 10 but have figured it out.
You need to register your class the same way you'd register a new field see docs here
So it'd look something like this:
Hope this works for you if you've not already figured it out!
Hello Warren,
I totally forgot about updating this post myself, I had figured it out the same way you did and ended up adding an IComposer to add the Checkbox just like you!
is working on a reply...