Skip to content

SiFormContainerComponent documentation

import { SiFormContainerComponent } from '@siemens/element-ng/form';

Deprecated: This component should no longer be used.

When providing a form wide error mapper, use the provideFormValidationErrorMapper.

import { provideFormValidationErrorMapper } form '@siemens/element-ng/forms'

@Component({
  template: `<form>...</form>`
  providers: [provideFormValidationErrorMapper({
    'name.required': 'CUSTOM_REQUIRED_ERROR'
  })]
})
class MyFormComponent {}

When using the column layout, use the form-col-layout classes.

<!-- Responsive column layout -->
<form class="responsive-form-col-layout">...</form>
<!-- Always column layout -->
<form class="form-col-layout">...</form>

For a custom breakpoint use the SCSS mixin:

@use '@siemens/element-theme/src/styles/bootstrap/mixins/form-layout';

// Custom responsive breakpoint
.custom-form-col-layout {
  // Above 400px the column layout is used
  @include form-layout.responsive-form-col-layout(400px);
}

Input Properties

NameTypeDefaultDescription
contentContainerBreakpoints
Breakpoints | undefined

The container hosts the form within a siResizeContainer to configure the breakpoint for different screen sizes. Optionally, change the container breakpoints with the contentContainerBreakpoints input.

controlNameTranslateKeyMap
Map<string, string> new Map<string, string>()

A map the maps from control names of the form to their translate keys. The initial map is empty and the user is responsible to add the required translate keys.

disableContainerBreakpoints
boolean false

In some scenarios, one may not want the form container to be responsible for the layout relevant si-container-[xs|...] classes, but let this be done by a different, nested component, e.g. by a group box. In these cases, the property should be set to true.

disableErrorPrinting
boolean false

Disables the automatic error printing in all nested SiFormItemComponent. Error printing will be enabled by default in v46.

errorCodeTranslateKeyMap
SiFormValidationErrorMapper | Map<string, string> | undefined

Every validation error has an errorCode. This map holds translate keys for error codes. The keys can be used to display a translated message for each validation error. The defaults old english readable key defaults for the Angular standard validators of the Validators class like min, max or required.

Use the input to set your own translate keys for the form validators you need.

form
FormGroup<TControl> | undefined

Set the form entity to the container to enable the overall form validation on in the form container edit panel.

labelWidth
string | undefined

A custom width value to be applied to all labels.

Example:

labelWidth="100px".
readonly
boolean false

A form container in readonly mode is only displaying the form content without ability to change it. The edit panel with typically save and cancel buttons is hidden. Set to true to display the edit panel.

Attributes and Methods

NameTypeDescription
(readonly) invalidFormContainerMessage
boolean

Indicates whether the content editor message shall be styled as warning.

Returns: true, if SiFormContainerComponent.userInteractedWithForm is true and the form is invalid.

(readonly) userInteractedWithForm
boolean

Indicates whether the user interacted with the form.

Returns: true, if the user selected at least one form element and [blurred]https://developer.mozilla.org/en-US/docs/Web/API/Element/blur_event by losing focus again (e.g. by setting focus on another element), or by editing the content of a form element. Otherwise false.

(readonly) validFormContainerMessage
boolean

Indicates whether content editor message shall be styled as success.

Returns: true, if SiFormContainerComponent.userInteractedWithForm is true and the form is valid.

Types Documentation

import type { Breakpoints } from '@siemens/element-ng/resize-observer';
import type { SiFormValidationErrorMapper } from '@siemens/element-ng/form';

Interface for form error mapper. It resolves a key to either a translatable string or function which is called with the validation error for its key and should return a translatable string.

Properties
Index Signatures
import type { TranslatableString } from '@siemens/element-translate-ng/translate-types';

Represents a translatable string. This can either be a translation key, e.g. ACTIONS.EDIT that will be automatically translated when displayed on the UI or a pre-translated string, e.g. Edit. Equivalent to a normal string in usage and functionality.


Except where otherwise noted, content on this site is licensed under MIT License.