Table of Contents

Class InputHtml5Attribute

Namespace
Dynamicweb.Content.Items.Annotations
Assembly
Dynamicweb.dll

Provides information about the html5 input field.

[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = false)]
public class InputHtml5Attribute : FieldAttribute
Inheritance
InputHtml5Attribute
Inherited Members

Examples

using System;
using System.Collections.Generic;
using Dynamicweb.Content.Items;
using Dynamicweb.Content.Items.Activation;
using Dynamicweb.Content.Items.Annotations;
using Dynamicweb.Content.Items.Editors;
using Dynamicweb.Content.Items.Metadata;
using Dynamicweb.Core.UI.Icons;

namespace Dynamicweb.Examples.Items;

[Item("Item with all field types", "The example of code-first item")]
[AreaRule,
 ModuleAttachmentRule(true),
 StructureRule(StructureContextType.Pages, StructureContextType.Paragraphs),
 ParentRule(ParentRestrictionRule.ParentType.RootOfWebsite, ParentRestrictionRule.ParentType.RegularPage),
 ChildRule(true), ChildRule("ExampleCategory", "ExampleRegion")]
[Category("Example"),
 PageDefaultView(PageDefaultView.Paragraph),
 Icon(KnownIcon.Archive)]
public class ExampleAllFieldTypesItem : ItemEntry
{
    [Group("StandardFields")]
    [Checkbox]
    public bool FieldCheckbox { get; set; }

    [Group("StandardFields")]
    [Color("Color", Presets = "#FFF, #151515, #444544, #5E5E5E, #005731, #287D59, #31988D, #2D73AB, #384E9A, #703F96, #9F3F95, #A93948, #E6A04B, #DD823A, #9BBF53, #0085CA, #1C588F")]
    [DefaultValue("#151515")]
    public string FieldColor { get; set; } = "";

    [Group("StandardFields")]
    [DefaultValue("Now")]
    public DateTime FieldDate { get; set; }

    [Group("StandardFields")]
    [DefaultValue("Now")]
    [DateTime]
    public DateTime FieldDateTime { get; set; }

    [Group("StandardFields")]
    [Decimal]
    public decimal FieldDecimal { get; set; }

    [Group("StandardFields")]
    [File("File", "/Images/Products", "gif,jpg,png", AllowFrontendUpload = true, ShowAsImageSelector = true, UseFocalSelector = true)]
    public string FieldFile { get; set; } = "";

    [Group("StandardFields")]
    [Folder("Folder", "*.png")]
    public string FieldFolder { get; set; } = "";

    [Group("StandardFields")]
    [Geolocation("Geolocation", AddressFields = "Street,Number,City,Zip")]
    public string FieldGeolocation { get; set; } = "";

    [Group("StandardFields")]
    [GoogleFont("Google font", "Lato", "italic")]
    public string FieldGoogleFont { get; set; } = "";

    [Group("StandardFields")]
    [ColorSwatch("Font color")]
    public string FieldFontColor { get; set; } = "";

    [Group("StandardFields")]
    [HiddenField]
    public string FieldHidden { get; set; } = "";

    [Group("StandardFields")]
    [InputHtml5("Html5", InputType = "Number", Min = 0, Max = 10)]
    public int FieldHtml5 { get; set; }

    [Group("StandardFields")]
    [Integer]
    public int FieldInteger { get; set; }

    [Group("StandardFields")]
    [Link]
    public string FieldLink { get; set; } = "";

    [Group("StandardFields")]
    [LinkToItem]
    public string FieldLinkToItem { get; set; } = "";

    [Group("StandardFields")]
    [ItemTypeEditor("Item", "ExampleCustomer")]
    public string FieldItem { get; set; } = "";

    [Group("StandardFields")]
    [Password]
    public string FieldPassword { get; set; } = "";

    [Group("StandardFields")]
    public string FieldText { get; set; } = "";

    [Group("StandardFields")]
    [LongText]
    public string FieldLongText { get; set; } = "";

    [Group("StandardFields")]
    [RichText]
    public string FieldRichText { get; set; } = "";

    [Group("StandardFields")]
    [ItemRelationList("Relation list", "ExampleNewsItem", ItemRelationListEditor.ItemListSource.Page, "Title", "SubTitle")]
    [Option("Title"), Option("Subtitle"), Option("NewsType")]
    public int FieldRelationList { get; set; }

    [Group("ListFields", LayoutGroupMetadata.GroupCollapsibleState.Collapsed)]
    [DropdownList(RemoveNothingSelected = true)]
    [OptionItem("ExampleCategory", "Name", "Id", SourceType = FieldOptionItemSourceType.CurrentArea)]
    public string FieldDropdownList { get; set; } = "";

    [Group("ListFields")]
    [CheckboxList(AllowOptionsSorting = true)]
    [OptionSql("SELECT TOP 10 ProductId, ProductName FROM EcomProducts WHERE ProductPrice > 100", "ProductName", "ProductId")]
    public IEnumerable<string> FieldCheckboxList { get; set; } = [];

    [Group("ListFields")]
    [RadiobuttonList]
    [Option("News"), Option("Featured"), Option("Add")]
    [DefaultValue("News")]
    public string FieldRadiobuttonList { get; set; } = "";

    [Group("ListFields")]
    [RadiobuttonList(IconPosition = 1, IconMaxWidth = 140, IconMaxHeight = 100)]
    [OptionFolder("/Images")]
    public string FieldRadioFolderList { get; set; } = "";

    [Group("ListFields")]
    [EditableList]
    public string FieldEditableList { get; set; } = "";

    [Group("SpecialFields")]
    [SingleUser(Name = "User")]
    public string FieldUser { get; set; } = "";

    [Group("SpecialFields")]
    [SingleUserGroup(Name = "Group")]
    public string FieldGroup { get; set; } = "";

    [Group("SpecialFields")]
    [UserGroups(Name = "Groups")]
    public string FieldGroups { get; set; } = "";
}

Constructors

InputHtml5Attribute()

Initializes a new instance of an object.

public InputHtml5Attribute()

InputHtml5Attribute(string)

Initializes a new instance of an object.

public InputHtml5Attribute(string name)

Parameters

name string

User-friendly name of the field.

InputHtml5Attribute(string, string, string, string, int, int, int, int, bool, bool)

Initializes a new instance of an object.

public InputHtml5Attribute(string name, string type, string pattern, string placeholder, int size, int min, int max, int step, bool autocomplete, bool required)

Parameters

name string

User-friendly name of the field.

type string

The type of HTML5 input.

pattern string

The regular expression that the input element's value is checked against.

placeholder string

The short hint that describes the expected value of an input field.

size int

The visible width, in characters, of an input element.

min int

The minimum value allowed.

max int

The maximum value alloweds.

step int

The legal number intervals.

autocomplete bool

Whether or not an input field should have autocomplete enabled.

required bool

The input field must be filled out before submitting the form.

Properties

Autocomplete

Gets or sets whether or not an input field should have autocomplete enabled.

public bool Autocomplete { get; set; }

Property Value

bool

InputType

Gets or sets the type of HTML5 input

public string InputType { get; set; }

Property Value

string

Max

Gets or sets the maximum value alloweds.

public int Max { get; set; }

Property Value

int

Min

Gets or sets the minimum value allowed.

public int Min { get; set; }

Property Value

int

Pattern

Gets or sets the pattern attribute specifies a regular expression that the input element's value is checked against.

public string Pattern { get; set; }

Property Value

string

Placeholder

Gets or sets a short hint that describes the expected value of an input field.

public string Placeholder { get; set; }

Property Value

string

Required

Gets or sets that an input field must be filled out before submitting the form.

public bool Required { get; set; }

Property Value

bool

Size

Gets or sets the visible width, in characters, of an input element.

public int Size { get; set; }

Property Value

int

Step

Gets or sets the legal number intervals.

public int Step { get; set; }

Property Value

int

Methods

InitializeEditorConfiguration(ItemField)

protected override void InitializeEditorConfiguration(ItemField itemField)

Parameters

itemField ItemField
To top