Button Type
The Button renders a <button type="submit">
element by default, as this is the default behavior of a button. This article explains how to change it, and how to link forms to external submit buttons.
You can control the type
attribute through the ButtonType
property of the component which can accept the following values:
-
Submit
- Renders atype="submit"
attribute. Can submit the form and trigger validation. The default value. -
Button
- Renders atype="button"
attribute. Does not invoke form validation and submission. -
Reset
- Renders atype="reset"
attribute. Can reset the current form.
<TelerikButton>Implicit SUBMIT</TelerikButton>
<TelerikButton ButtonType="@ButtonType.Submit">Explicit SUBMIT</TelerikButton>
<TelerikButton ButtonType="@ButtonType.Button">BUTTON</TelerikButton>
<TelerikButton ButtonType="@ButtonType.Reset">RESET</TelerikButton>
Form Parameter
The Blazor Button has another parameter related to form submission - Form
. It allows you to associate a form with a submit button, which is outside the form. Use together with the Id
parameter of the Form and set both parameters to the same string
value.