The `kendo-formfield` component should contain only one control of type NgControl with a formControlName

0 Answers 2229 Views
CheckBox ComboBox DropDownList Label TextBox
Robert
Top achievements
Rank 2
Robert asked on 07 Oct 2022, 10:59 AM | edited on 07 Oct 2022, 11:00 AM

Hi!

I searched the forum but found no answer. I have several controls in the form, each one inserted according to the scheme:

      <div fxFlex="30">
        <kendo-formfield [orientation]="'horizontal'">
          <kendo-label text="Rodzaj przewozów">
            <kendo-dropdownlist #transportTypeDropdown class="transport-type" [data]="transportTypes"
              [textField]="'name'" [valueField]="'id'" [formControlName]="formNames.transportType"
              [(value)]="formModel.transportType" [disabled]="areControlsDisabled">
            </kendo-dropdownlist>
          </kendo-label>
          <app-form-error [controlName]="formNames.transportType" [form]="form"></app-form-error>
        </kendo-formfield>
      </div>
      <div fxFlex="10">
        <kendo-formfield [orientation]="'horizontal'">
          <kendo-label text="wyszukaj bez trasy">
            <input type="checkbox" #searchWithoutRouteCheckbox class="search-without-route-type"
              [formControlName]="formNames.searchWithoutRoute" [value]="formModel.searchWithoutRoute" kendoCheckBox
              [disabled]="areControlsDisabled" />
          </kendo-label>
          <app-form-error [controlName]="formNames.searchWithoutRoute" [form]="form"></app-form-error>
        </kendo-formfield>
      </div>
      <div fxFlex="10">
        <kendo-formfield [orientation]="'horizontal'">
          <kendo-label text="Przes. kal. 2">
            <kendo-dropdownlist #calendarShiftDropdown class="calendar-shift" [data]="calendarShiftItems"
              [textField]="'text'" [valueField]="'value'" [formControlName]="formNames.calendarShift"
              [valuePrimitive]="true" [(value)]="formModel.calendarShift" [disabled]="areControlsDisabled">
            </kendo-dropdownlist>
          </kendo-label>
          <app-form-error [controlName]="formNames.calendarShift" [form]="form"></app-form-error>
        </kendo-formfield>
      </div>

 

and I get errors in the console:

The `kendo-formfield` component should contain only one control of type NgControl with a formControlName

AFAIS there's no doubled controls in formfield. In other form I have simmilar controls and getting no errors and I'm stuck on this issue. What I'm doing wrong?


Yanmario
Telerik team
commented on 12 Oct 2022, 07:05 AM

Hi Robert,

I am not able to find any issues in the HTML markup, in such case it might be a binding typo which can cause such issues if there is mistake in the spelling.

Could you provide a runnable example demonstrating the error? That will help me troubleshoot the application and possibly find the root cause of the issue. Thank you in advance for your cooperation.

Regards,
Yanmario
Progress Telerik     

Nathaniel
Top achievements
Rank 1
commented on 15 Oct 2022, 04:20 AM | edited

In my case, there was no control of type NgControl with a formControlName

(I had a <kendo-numerictextbox>, but it was using: [value]="formGroup.get('wineGallons')?.value", isntead of [formControlName])

So I think "only one" was confusing me; a message like this might've helped me find the issue faster:
 > The `kendo-formfield` component is missing a control of type NgControl with a formControlName

 

Yanmario
Telerik team
commented on 19 Oct 2022, 12:16 PM

Hi Nathaniel,

I am happy to hear that you were able to resolve the error. With the error sometimes it is hard to determine the root cause and some troubleshooting would be required like removing some of the components to see which could be causing the issue. 

I will write this down and raise this matter in our next developer meeting if the error message can be improved with better context.

Regards,
Yanmario
Progress Telerik     

Robert
Top achievements
Rank 2
commented on 30 Nov 2022, 01:09 PM

Hi Nathaniel & Yanmario!

I can confirm that my error was appearing due to missing formControlName on the form control. Thank you for your help!

Sergey
Top achievements
Rank 1
commented on 29 Dec 2022, 09:30 AM

Hi there!

This error shouldn't exist for fields with just value, without formControlName. This error in this case just a destruction, it bloats console with lots of duplicates. Now it throws an error to console, but it shouldn't because I pass value to the field through [value] binding.

Sergey
Top achievements
Rank 1
commented on 05 Jan 2023, 11:44 AM

Any updates regarding this one?
Yanmario
Telerik team
commented on 10 Jan 2023, 08:25 AM

Hi Sergey,

At this current time, there isn't an update on this matter and I cannot promise that improvements in the error messages will be implemented in the following releases. The team would need to discuss this matter and decide if improvements are needed at this stage.

Regards,
Yanmario
Progress Telerik     

No answers yet. Maybe you can help?

Tags
CheckBox ComboBox DropDownList Label TextBox
Asked by
Robert
Top achievements
Rank 2
Share this question
or