Hi,
I’m trying to customise the existing FieldTypes (such as Textbox, Textarea, FileUpload etc.) so that I can define default values that are pre-filled when building the form for some of the settings properties. I’ve attempted this by using Adding A Field Type To Umbraco Forms | Umbraco Forms as a guide however I’ve not been successful.
For example, I’ve tried the following code in an attempt to have The ‘AutocompletAttribute’ property value pre-filled and defaulted to “on” for the Textarea field type:
public class Textarea : Umbraco.Forms.Core.Providers.FieldTypes.Textarea
{
[Setting(
"Show Label",
Description = "Indicate whether the the field's label should be shown when rendering the form.",
View = "checkbox",
PreValues = "true",
DisplayOrder = 30,
IsHidden = true
)]
public override string ShowLabel { get; set; } = "True";
[Setting(
"Autocomplete attribute",
Description = "Optionally enter a value for the autocomplete attribute.",
PreValues = "on",
View = "TextField",
DisplayOrder = 40
)]
public override string AutocompleteAttribute { get; set; } = "on";
[Setting(
"Number Of Rows",
Description = "Enter the number of rows displayed for entry",
View = "NumericField",
PreValues = "5",
DisplayOrder = 50
)]
public override string NumberOfRows { get; set; } = "5";
public override bool SupportsRegex => false;
}
In this situation, I’m trying to auto-populate the highlighted area with “on” when the Question modal is first loaded:
Lastly, I’ve tried to locate a Forms specific Notification that would allow for the pre-population of these values like the SendingContentNotification (EditorModel Notifications | Umbraco CMS) that allows for pre-population of values in the Content section of Umbraco. However, I have not been able to find anything in the documentation or Umbraco.Forms namespace.
Unfortunately, all of the above have failed to produce the results I am after. Does anyone know how I can achieve this?