SubmitButton
| Extends | ButtonBase |
|---|---|
| Namespace | Skybrud.Forms.Models.Fields |
| Type | submit |
The SubmitButton class represents a HTML reset button similar to writing <button type="submit"></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 |
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 submit button - eg. via an extension method directly on the form:
form.AddSubmitButton("submitButton", "Submit");
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 SubmitButton class and add it the the form's Fields property:
form.Fields.Add(new SubmitButton {
Name = "submitButton",
Label = "Submit",
Description = "This button will submit the form.",
Value = "please-submit"
});