FormGroup Blazor API

FormGroup Properties

NameTypeDefaultDescription
Columnsint1Gets or sets the number of columns used to layout the form fields, allowing for multi-column form arrangements.
DataFieldstring""Defines the data field associated with the form control. The inner input element’s name attribute will be set to the specified dataField value, ensuring correct binding and form data serialization. Additionally, this value determines how the control is referenced within the FormGroup, making the form control’s value accessible via the dataField key in the form’s data model.
Labelstring""Retrieves or updates the text displayed as the label for the form control, allowing you to specify or modify the descriptive text shown to users alongside the input element.
ControlsIEnumerable<IFormGroupControl>N/A
OnStatusChangesAction<object>N/AA callback function that is invoked whenever the status changes. The function receives a single argument—a string representing the new status—which will be one of the following values: ''valid'', ''invalid'', ''disabled'', or ''pending''. Use this callback to implement custom behavior in response to status updates.
OnValueChangesAction<object>N/ACallback function invoked whenever the form value changes. Receives the updated form data as a JSON object, allowing you to respond to or process the latest values.
LabelPositionFormGroupLabelPositionFormGroupLabelPosition.LeftSpecifies or retrieves the position of the labels relative to their associated element. This property can be used to define where labels are displayed, such as above, below, to the left, or to the right of the element.
ReadonlyboolfalseSets the form to read-only mode, preventing users from editing or modifying any of the input fields while still allowing them to view the current values.
ShowColonAfterLabelboolfalseToggles the visibility of the colon character that appears immediately after label text, allowing you to choose whether or not a colon is displayed following each label.
ShowSummarybooltrueControls the visibility of the validation summary, allowing you to display or hide a summary of form validation errors to users.
ValueobjectN/ARetrieves the current value of the form or updates it with a new value. This property can be used to access the form's data or set it programmatically.

FormGroup Methods

NameTypeArgumentsDescription
AddControlvoidobject controlOptionsInserts a new input control (such as a text box, dropdown, or checkbox) into the Form, allowing users to provide or select additional information as part of their submission.Args: object controlOptions - Control options. The control options description is available in the "controls" property.
GetControlControlstring dataFieldRetrieves a specific control from the collection using its name, as specified by the dataField parameter. This function searches for a control whose name matches the provided dataField value and returns the corresponding control object, allowing you to access or manipulate its properties and methods.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 user interface control (such as a text box, dropdown, or button) to the specified Form, enabling users to input or interact with form data. This operation dynamically updates the Form’s layout and may include assigning default properties, event handlers, and positioning options for the new control.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, effectively deleting it from the Form’s structure and user interface. This operation detaches the control, ensuring it is no longer available for user interaction or data capture. Use this action to dynamically update the Form’s contents based on user actions or application logic.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.
StateHasChangedvoid'N/A'Refreshes the state and Re-renders the Blazor Component, if necessary.

Enums

FormGroupControlControlType

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

FormGroupControlLabelPosition

FormGroupControlLabelPosition.Left
FormGroupControlLabelPosition.Top

FormGroupControlViewMode

FormGroupControlViewMode.Null
FormGroupControlViewMode.Accordion
FormGroupControlViewMode.Tabs
FormGroupControlViewMode.Breadcrumb

FormGroupLabelPosition

FormGroupLabelPosition.Left
FormGroupLabelPosition.Top

FormGroupControl Properties

NameTypeDefaultDescription
AppendHTMLobject""HTML Content displayed after the Form Control
ControlOptionsobject""JSON 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.
ControlTypeFormGroupControlControlTypeFormGroupControlControlType.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.
LabelPositionFormGroupControlLabelPositionFormGroupControlLabelPosition.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.
PrependHTMLobject""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
ShowColonAfterLabelboolfalseGets or Sets whether colon is displayed after the label.
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.
ViewModeFormGroupControlViewModeFormGroupControlViewMode.NullFormGroup only(when controlType is set to 'group'). Gets or Sets the form'group view mode.