-
Notifications
You must be signed in to change notification settings - Fork 2
Form.withFields
API / Form<TValidationError> / withFields method
Adds the provided fields to the form, returns an observable collection containing them.
Any changes made to the returned collection is reflected in the form as well, added fields are added, removed fields are removed, sorting or moving fields around are moved in the form as well.
protected withFields(
...fields: readonly FormField<any, TValidationError>[]
): IObservableCollection<FormField<any, TValidationError>>
Source reference: src/forms/Form.ts:704
.
Returns: IObservableCollection<FormField<any
, TValidationError>>
Returns a collection containing the provided fields. The form reacts to changes made in the returned collection always keeping in sync.
This method adds the provided fields to the form, a necessary step to watch the form fields for
changes as well as their validity. The Form.isValid
and Form.isInvalid
properties
are dependent on the fields.
class MyForm extends Form {
public constructor() {
super();
this.withFields(
this.name = new FormField({
name: 'name',
initialValue: ''
})
);
}
public readonly name: FormField<string>;
}
Overview
Motivation
Guides and Tutorials - Getting Started
Releases
CodeSandbox
API
Events
IEvent
IEventHandler
EventDispatcher
ViewModels
INotifyPropertiesChanged
ViewModel
Forms
Form
IFormFieldConfig
FormField
ReadOnlyFormCollection
FormCollection
IConfigurableFormCollection
FormSetupCallback
Validation
IValidator
ValidatorCallback
IObjectValidator
IValidatable
Validation / Triggers
WellKnownValidationTrigger
ValidationTrigger
Observable Collection
ReadOnlyObservableCollection
ObservableCollection
INotifyCollectionChanged
CollectionChangeOperation
INotifyCollectionReordered
CollectionReorderOperation
Observable Map
ReadOnlyObservableMap
ObservableMap
INotifyMapChanged
MapChangeOperation
Observable Set
ReadOnlyObservableSet
ObservableSet
INotifySetChanged
SetChangeOperation
Dependency Handling
IDependencyResolver
IDependencyContainer
DependencyContainer
useDependency
useViewModelDependency
useDependencyResolver
React Hooks
useViewModel
useViewModelMemo
useObservableCollection
useObservableMap
useObservableSet