ResetButton

Extends ButtonBase
Namespace Skybrud.Forms.Models.Fields
Type reset

The ResetButton class represents a HTML reset button similar to writing <button type="reset"></button>.

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.

Usage

The package supports a few different ways to add a button - eg. via an extension method directly on the form:

form.AddResetButton("resetButton", "Reset");

The extension method doesn't support all properties available for a button, but adds a shortcut for easier adding simple buttons.

For a bit more control, you can initialize a new ResetButton class and add it the the form's Fields property:

form.Fields.Add(new ResetButton {
    Name = "resetButton",
    Label = "Reset",
    Description = "This button will reset the form.",
    Value = "please-reset"
});