[td-dynamic-forms] [Question] [Usage example] - How do you retrieve data from dynamic form?
See original GitHub issueHey,
Could someone give me an idea how to properly retrieve data from <td-dynamic-forms> component?
What I tried so far is using a @ViewChild to get FormGroup:
@ViewChild(TdDynamicFormsComponent) form: TdDynamicFormsComponent;
and then I was subscribing to valueChanges.
ngAfterViewInit() {
this.form.form.valueChanges.subscribe( (val) => {
this.change.emit(val);
});
}
it works, until I change the property [elements] to different value:
<td-dynamic-forms [elements]="newArrayOfElements"> </td-dynamic-forms>
then I get an error:
There is no FormControl instance attached to form control element with name: xxx
Any suggestions on that?
Issue Analytics
- State:
- Created 6 years ago
- Comments:11 (4 by maintainers)
Top Results From Across the Web
Creating Dynamic Forms & Get Data from ... - Vipin Vijayan
Let's create a dynamic List based on the counter with each form having a TextField. _row(int index) { return Row( children: [ Text('ID:...
Read more >Salesforce Dynamic Forms: Overview & Deep Dive Tutorial
Dynamic Forms are available now! Simply go to the Lightning record page of a custom object and select the “Highlights Panel” or the...
Read more >Building dynamic forms - Angular
In this tutorial you will build a dynamic form that presents a basic questionnaire. You build an online application for heroes seeking employment....
Read more >How To Build Dynamic Forms - Appsmith - YouTube
This video explains how to build dynamic forms in Appsmith using the List widget. The also explains how to extract input data from...
Read more >Create Dynamic Microsoft Form and Process Response using ...
In this video, I will show how to create a dynamic (conditional) Microsoft Form using section and branching. I will use a Product...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I got some support over email that solved my problem. Here’s the code that’s needed:
It would be helpful in the docs if the code could be extended with something like this:
This way developers can easily see the intended way of accessing data in the documentation. Right now, there’s a submit button but it’s not hooked up to anything. The creation of forms is intuitive, but accessing them isn’t very straightforward at all.
<ng-template let-param ngFor [ngForOf]=“params”>
<td-dynamic-forms [elements]=“param.elements” #paramform> <ng-template let-element ngFor [ngForOf]=“param.elements”> <ng-template let-control=“control” [tdDynamicFormsError]=“element.name”> <span *ngIf=“control.touched || !control.pristine”> <span *ngIf=“control.hasError(‘required’)”>Required</span> <span *ngIf=“control.hasError(‘min’)”>Min value: {{element.min}}</span> <span *ngIf=“control.hasError(‘max’)”>Max value: {{element.max}}</span> <span *ngIf=“control.hasError(‘minlength’)”>Min length value: {{element.minLength}}</span> <span *ngIf=“control.hasError(‘maxlength’)”>Max length value: {{element.minLength}}</span> </span> </ng-template> </ng-template> </td-dynamic-forms> </ng-template>
how do I get the form values from the multiple forms generated, Now I can only get the first form’s value only. I want to get even if they are 10 forms dynamically generated