Form Blazor API

Form Properties

NameTypeDefaultDescription
Columnsint1Defines or retrieves the number of columns used to arrange form fields, determining how fields are organized and displayed within the form layout.
ControlsIEnumerable<IControl>N/AGets or sets the collection of form controls associated with the form. This allows you to retrieve the current controls or update them with a new set of controls.
OnStatusChangesAction<object>N/ACallback function invoked when the status changes. The status parameter passed to the function reflects the new state of the process, and can be one of the following string values: 'disabled', 'invalid', 'pending', or 'valid'. Use this callback to handle logic based on each specific status transition.
OnValueChangesAction<object>N/ACallback function invoked when the form's value changes. Receives the updated form data as a JSON object argument, allowing you to handle or process the new values within your application.
LabelPositionFormLabelPositionFormLabelPosition.LeftDefines or retrieves the position of the labels relative to their associated elements. Specify this property to control where labels are displayed (e.g., above, below, left, or right of the element).
ReadonlyboolfalseSets all form fields to read-only mode, preventing users from modifying their input while still allowing them to view the existing data.
ShowColonAfterLabelboolfalseControls the visibility of the colon character that appears after label text. When enabled, a colon is displayed after each label; when disabled, the colon is omitted.
ShowSummarybooltrueToggles the visibility of the validation summary, allowing users to display or hide a list of validation errors based on form input.
StatusobjectN/ARetrieves the current status of the Form. Each entry within the status object contains the following boolean properties: dirty (indicates if the form field has been modified), untouched (indicates if the field has not been focused by the user), and disabled (indicates if the field is currently disabled).
ValueobjectN/ARetrieves or assigns the current value of the form. Use this property to access the form's data for processing or to update the form with new values programmatically.
ValidateOnLoadboolfalseAutomatically triggers form validation immediately upon form initialization, ensuring that all form fields are checked for correctness as soon as the form is rendered or instantiated.

Form Methods

NameTypeArgumentsDescription
AddControlvoidobject controlOptionsInserts a new control element, such as an input field, button, or checkbox, into the Form, allowing users to interact with and submit data.Args: object controlOptions - Control options. The control options description is available in the "controls" property.
GetControlControlstring dataFieldRetrieves a specific control element from the form using its name attribute, as defined by the dataField parameter. This method enables direct access to the control's properties and methods for further manipulation or data retrieval.Args: string dataField - dataField of a FormControl or FormGroup
GetValueAsync()Task<object>'N/A'Gets the &quot;Value&quot; property as Task&lt;object&gt;.
InsertControlvoidint index, object controlOptionsAdds a new control element to the Form, allowing users to dynamically extend the form’s functionality. This method enables the inclusion of input fields, buttons, dropdowns, or other interactive components within the Form, ensuring seamless integration and consistent behavior with existing controls.Args: int index - Control insert index,object controlOptions - Control options. The control options description is available in the "controls" property.
Refreshvoid'N/A'Refreshes the Blazor Component. Performs a layout of the HTML Elements and recalculates the measurements.
RemoveControlvoidobject controlOptionsRemoves a specified control element from the Form, ensuring it is no longer rendered or managed as part of the Form's structure and behavior.Args: object controlOptions - Control options. The control options description is available in the "controls" property.
Rendervoid'N/A'Re-renders the Blazor Component. This method will make a full re-render.
ResetvoidN/AResets all fields in the form to their initial, default values, effectively clearing any user input or changes made.
StateHasChangedvoid'N/A'Refreshes the state and Re-renders the Blazor Component, if necessary.
Submitvoidobject submitOptionsTriggers the submission of the form, sending the user-entered data to the specified server endpoint for processing. This action may also initiate form validation and execute any associated event handlers before transmitting the data.Args: object submitOptions - Sets the submit options object. The object may have the following properties: "async", "action", "target", "method". "async" determines whether the form will be submitted asynchronously. "action" determines the submit url, "method" sets whether the submit is through 'GET' or 'POST'. "target" determines the submit target.
SubmitvoidN/ATriggers the submission of the form, sending the user-entered data to the specified server endpoint for processing. This action may also initiate form validation and execute any associated event handlers before transmitting the data.
ValidatevoidN/APerforms comprehensive validation of the form fields, ensuring that all required inputs are provided, data types and formats are correct, and any specified constraints or validation rules are met before allowing form submission.

Enums

ControlControlType

ControlControlType.Button
ControlControlType.Boolean
ControlControlType.ComboBox
ControlControlType.CheckInput
ControlControlType.Datetime
ControlControlType.DropDownList
ControlControlType.Group
ControlControlType.Input
ControlControlType.Label
ControlControlType.MultiInput
ControlControlType.MultiComboInput
ControlControlType.Mask
ControlControlType.Number
ControlControlType.Password
ControlControlType.RadioButton
ControlControlType.Submit
ControlControlType.Textarea
ControlControlType.Template

ControlControlControlType

ControlControlControlType.Button
ControlControlControlType.Boolean
ControlControlControlType.ComboBox
ControlControlControlType.CheckInput
ControlControlControlType.Datetime
ControlControlControlType.DropDownList
ControlControlControlType.Group
ControlControlControlType.Input
ControlControlControlType.Label
ControlControlControlType.MultiInput
ControlControlControlType.MultiComboInput
ControlControlControlType.Mask
ControlControlControlType.Number
ControlControlControlType.Password
ControlControlControlType.RadioButton
ControlControlControlType.Submit
ControlControlControlType.Textarea
ControlControlControlType.Template

ControlControlLabelPosition

ControlControlLabelPosition.Left
ControlControlLabelPosition.Top

ControlControlViewMode

ControlControlViewMode.Null
ControlControlViewMode.Accordion
ControlControlViewMode.Tabs
ControlControlViewMode.Breadcrumb

ControlLabelPosition

ControlLabelPosition.Left
ControlLabelPosition.Top

ControlViewMode

ControlViewMode.Null
ControlViewMode.Accordion
ControlViewMode.Tabs
ControlViewMode.Breadcrumb

FormLabelPosition

FormLabelPosition.Left
FormLabelPosition.Top

Control Properties

NameTypeDefaultDescription
Appendstring""HTML Content displayed after the Form Control
ControlOptionsobjectnullJSON object with initialization properties of the UI component. Example: { dataSource: ['item 1', 'item 2', 'item 3'] } will set the dataSource property of the Form control.
ControlTypeControlControlTypeControlControlType.InputThe type of the control.
Columnsint1Sets the Form Group columns.
ColumnSpanint1Sets the Form control column span.
ControlsIEnumerable<IControlControl>null
DataFieldstring""Sets the Form control data field. The control's inner input's name is set to the dataField value and in the FormGroup it is accessible through the dataField value.
DisabledboolfalseSets the Form control disabled mode.
DirtyboolfalseGets whether the Form control is 'dirty' i.e its value is changed by the user.
Infostring""Gets or Sets the Form control's info icon's tooltip.
InvalidboolfalseGets whether the Form control is invalid.
Labelstring""Gets or Sets the Form control's label.
LabelPositionControlLabelPositionControlLabelPosition.LeftGets or Sets the Form control's label position.
LabelOffsetint10Gets or Sets the offset between the label and the control.
LabelAlignstring"left"FormGroup only(when controlType is set to 'group'). Gets or Sets whether the navigation buttons are displayed. The property has effect when the viewMode property is set.
NextButtonLabelstring"Next"FormGroup only(when controlType is set to 'group'). Gets or Sets the next button label.
BackButtonLabelstring"Back"FormGroup only(when controlType is set to 'group'). Gets or Sets the back button label.
Prependstring""HTML Content displayed before the Form Control
ReadonlyboolfalseGets or Sets the Form control readonly mode.
UntouchedboolfalseGets whether the Form control is not touched by the user. This flag is changed usually on blur, after the user interacted with the Form control
Placeholderstring""Gets or Sets the placeholder.
ShowButtonsboolfalseFormGroup only(when controlType is set to 'group'). Gets or Sets whether the navigation buttons are displayed. The property has effect when the viewMode property is set.
ValueobjectnullSets or Gets the Form control or Form group value.
ValidboolfalseGets whether the Form control is valid.
ValidationRulesIEnumerable<object>nullSets or gets the column's validation rules. The expected value is an Array of Objects. Each object should have a 'type' property that can be set to 'required', 'min', 'max', 'minLength', 'maxLength', 'email', 'null', 'requiredTrue', 'minData', 'maxDate', 'pattern'. The 'value' property should be set, too. For validation rule types 'required', 'requiredTrue' and 'null' you can skip the 'value' property. Optional property is 'message', which determines the error message.
ViewModeControlViewModeControlViewMode.NullFormGroup only(when controlType is set to 'group'). Gets or Sets the form'group view mode.

ControlControl Properties

NameTypeDefaultDescription
Appendstring""HTML Content displayed after the Form Control
ControlOptionsobjectnullJSON object with initialization properties of the UI component. Example: { dataSource: ['item 1', 'item 2', 'item 3'] } will set the dataSource property of the Form control.
ControlTypeControlControlControlTypeControlControlControlType.InputThe type of the control.
Columnsint1Sets the Form Group columns.
ColumnSpanint1Sets the Form control column span.
DataFieldstring""Sets the Form control data field. The control's inner input's name is set to the dataField value and in the FormGroup it is accessible through the dataField value.
DisabledboolfalseSets the Form control disabled mode.
DirtyboolfalseGets whether the Form control is 'dirty' i.e its value is changed by the user.
Infostring""Gets or Sets the Form control's info icon's tooltip.
InvalidboolfalseGets whether the Form control is invalid.
Labelstring""Gets or Sets the Form control's label.
LabelPositionControlControlLabelPositionControlControlLabelPosition.LeftGets or Sets the Form control's label position.
LabelOffsetint10Gets or Sets the offset between the label and the control.
LabelAlignstring"left"FormGroup only(when controlType is set to 'group'). Gets or Sets whether the navigation buttons are displayed. The property has effect when the viewMode property is set.
NextButtonLabelstring"Next"FormGroup only(when controlType is set to 'group'). Gets or Sets the next button label.
BackButtonLabelstring"Back"FormGroup only(when controlType is set to 'group'). Gets or Sets the back button label.
Prependstring""HTML Content displayed before the Form Control
ReadonlyboolfalseGets or Sets the Form control readonly mode.
UntouchedboolfalseGets whether the Form control is not touched by the user. This flag is changed usually on blur, after the user interacted with the Form control
Placeholderstring""Gets or Sets the placeholder.
ShowButtonsboolfalseFormGroup only(when controlType is set to 'group'). Gets or Sets whether the navigation buttons are displayed. The property has effect when the viewMode property is set.
ValueobjectnullSets or Gets the Form control or Form group value.
ValidboolfalseGets whether the Form control is valid.
ValidationRulesIEnumerable<object>nullSets or gets the column's validation rules. The expected value is an Array of Objects. Each object should have a 'type' property that can be set to 'required', 'min', 'max', 'minLength', 'maxLength', 'email', 'null', 'requiredTrue', 'minData', 'maxDate', 'pattern'. The 'value' property should be set, too. For validation rule types 'required', 'requiredTrue' and 'null' you can skip the 'value' property. Optional property is 'message', which determines the error message.
ViewModeControlControlViewModeControlControlViewMode.NullFormGroup only(when controlType is set to 'group'). Gets or Sets the form'group view mode.