我试图创建一个动态的表单组,我试图实现这一点
在“添加更多”上,单击“添加2动态字段”调用此函数:
onAddSurgeries(){
const control = new FormGroup({
'surgery': new FormControl(null),
'illness': new FormControl(null)
});
(<FormArray>this.form.get('surgeries')).push(control);
}
我的html就
我在一个Angular 7应用程序中使用模型驱动表单,其中一个表单允许用户动态添加/删除一组字段。这是我所指的视觉参考:
这是我使用的FormModel:
this.formModel = new FormGroup( {
id : new FormControl(''),
name : new FormControl('', Validators.required),
comment : new FormControl(''),
options : new FormControl(3),
我正在创建一个角度12的应用程序,与材料。
我有一个表单,其中包含一个从数据库动态加载的复选框数组。
我需要验证是否至少选中了一个复选框
我在我的OnInit()中这样定义
ngOnInit(): void {
this.form = this.fb.group({
Id: new FormControl(null),
Name: new FormControl('',Validators.required),
Recipents: new FormControl('',[Validators.required, m
在动态添加的FormGroup中,我似乎无法将焦点设置在输入字段上:
addNewRow(){
(<FormArray>this.modalForm.get('group1')).push(this.makeNewRow());
// here I would like to set a focus to the first input field
// say, it is named 'textField'
// but <FormControl> nor [<AbstractControl&g
我正在构建一个类似于下面这样的表单: private _buildForm(): FormGroup {
const _form = new FormGroup({
title: new FormControl('', [Validators.required]),
jobs: new FormArray([
new FormGroup({
_id: new FormControl(''),
status: new FormControl('')
});
])
});
} 当我想使
<!--Currently making web app that is a bunch of forms.
我使用VisualStudio2017创建了带有角7的ASP.NET Core2.2,当用户填写表单时,并不需要所有的表单数据。在用户输入所需的表单信息后,我希望有一个按钮,该按钮将弹出一个包含所有用户输入的数据和相应问题的弹出。如果在窗体上留下文本框或输入n/a,则不希望该信息出现在弹出窗口中。我希望弹出窗口有一个按钮来复制将粘贴到另一个站点上的表单中的数据。
I have created all my forms and also know how to create a
我需要使用angular react创建一个动态表单。但此for具有许多子窗体组,这些组可能会随窗体选择框值的不同而变化。
profileForm = new FormGroup({
firstName: new FormControl(''),
lastName: new FormControl(''),
department: new FormControl('')
});
部门类型为'a', 'b', 'c'。
如果用户选择'a',我将在prof
我正在使用的注册表单的角度反应形式。
this.personalDataForm = new FormGroup({
'name': new FormControl(null, Validators.required),
'username': new FormControl(null, Validators.required),
'address': new FormControl(null, Validators.required),
'email': new FormCont
从两个窗体控件计算后,如何设置窗体控件的值?这些控件是同一窗体组的一部分。并且表单组被动态地添加到表单数组中。
this.purchaseForm = this.fb.group({
purchases: this.fb.array([this.getPurchaseFormGroup()])
});
getPurchaseFormGroup(): FormGroup {
const form = new FormGroup({
itemName: new Form
我有日期选择器,它应该动态禁用和启用的复选框切换点击。所有来自库angular material 6的组件。由于我对表单处理程序使用的是反应式方法,所以我不能简单地使用[disable]指令。我得到了更多的错误:
It looks like you're using the disabled attribute with a reactive form directive. If you set disabled to true
when you set up this control in your component class, the disabled attribute wi
我有三个与表单链接的字段,类型是number,当我修改字段A时,它会修改字段B和C,当我修改字段B时,它会修改字段A和C,当我修改字段C时,它会相应地修改字段A和B。 我的组件如下: this.form= this.formBuilder.group({
fieldA: new FormControl(this.valueA),
fieldB: new FormControl(this.valueB),
fieldC: new FormControl(this.valueC),
});
onFieldAchanged() {
//Do some calculs