DropDownList

Extends ListBase
Namespace Skybrud.Forms.Models.Fields
Type dropdown

The DropDownList is field similar to the HTML <select> element.

Properties

The class has the following properties:

C# Name C# Type JSON Name Description
Type string type Inherited from the FieldBase class.
The type of the field - generally matching the HTML type attribute, or a custom value for non-HTML fields.
Name string name Inherited from the FieldBase class.
The name of the field - matching the value for the HTML `name` attribute.
Label string label Inherited from the FieldBase class.
A friendly name that should accompany the field.
Description string description Inherited from the FieldBase class.
A description that should accompany the field.
IsRequired bool required Inherited from the FieldBase class.
Whether the field is required/mandatory.
Value object value Inherited from the FieldBase class.
An optional value of the field.
Items List<ListItem> items Inherited from the ListBase class.
The individual items making up the checkboxes of the checkbox list.

JSON Output

{
  "type": "dropdown",
  "name": "myDropDownList",
  "label": "My dropdown list",
  "description": "A description for my dropdown list.",
  "required": true,
  "value": "1234",
  "items": [
    {
      "value": "1",
      "label": "1",
      "checked": false
    },
    {
      "value": "12",
      "label": "12",
      "checked": false
    },
    {
      "value": "123",
      "label": "123",
      "checked": false
    },
    {
      "value": "1234",
      "label": "1234",
      "checked": true
    },
    {
      "value": "12345",
      "label": "12345",
      "checked": false
    }
  ]
}