kendo-formfield
component when used within my custom wrapper component, FormFieldComponent
. Even though I am passing a single form control with formControlName
, the component keeps throwing the following error:Error: The `kendo-formfield` component should contain only one control of type NgControl with a formControlName or an ngModel binding.
I’ve created a custom wrapper component, FormFieldComponent
, which looks like this:
import { Component, Input, ViewEncapsulation } from '@angular/core';
import { CommonModule } from '@angular/common';
import { InputsModule, Orientation, ShowOptions } from '@progress/kendo-angular-inputs';
@Component({
selector: 'mnp-form-field',
standalone: true,
imports: [CommonModule, InputsModule],
encapsulation: ViewEncapsulation.None,
template: `
<kendo-formfield [orientation]="orientation!" [showErrors]="showErrors!" [showHints]="showHints!">
<ng-content></ng-content>
</kendo-formfield>
`,
styleUrl: './form-field.component.scss',
})
export class FormFieldComponent {
@Input() orientation?: Orientation;
@Input() showErrors?: ShowOptions;
@Input() showHints?: ShowOptions;
}
ReactiveFormsModule
setup. Here’s the story code:export const EmailFieldWithFormGroup: Story = {
render: () => {
const formBuilder = new FormBuilder();
const emailForm: FormGroup = formBuilder.group({
email: ['', [Validators.required, Validators.email]],
});
return {
props: {
emailForm,
emailControl: emailForm.get('email'),
onSubmit: () => {
if (emailForm.valid) {
console.log('Form submitted:', emailForm.value);
} else {
console.error('Form is invalid');
}
},
},
template: `
<form [formGroup]="emailForm" (ngSubmit)="onSubmit()">
<fieldset>
<legend>Email Field</legend>
<mnp-form-field>
<mnp-label [for]="'email'" text="Email"></mnp-label>
<mnp-textbox formControlName="email"></mnp-textbox>
<mnp-form-hint>Enter your email address</mnp-form-hint>
<mnp-form-error *ngIf="emailForm.controls['email'].invalid && emailForm.controls['email'].touched">
Error: Please provide a valid email address.
</mnp-form-error>
</mnp-form-field>
</fieldset>
</form>
`,
};
},
};
Is there a built-in Kendo form class for a grid-type layout? I know that the GridLayout component is available, was hoping that there was something built-in already that would be more straightforward to implement.
Thanks
Using formBuilder to create a reactive form when I noticed that it turns array properties in to the first object in the array. This is breaking my multiselect drop down as it is expecting an array.
I create a stack blitz demonstration.
https://stackblitz.com/edit/angular-bnet6z?file=src%2Fapp%2Fapp.component.ts
This is based off of you https://www.telerik.com/kendo-angular-ui/components/dropdowns/multiselect/forms/#toc-reactive-forms demonstration where I changed the form building to use the form builder.
Multiselect then reports these errors.
Hey everyone,
Hope this message finds you well.
I'm creating a grid table with Add/Edit/Delete features. Currently running into a blocker when clicking on a checkbox during an Add procedure. This action completely resets the values from the dropdown menus I've previously selected from. Any ideas as to why this behavior might be occurring? Thanks!
TS:
------------------------------
HTML:
Hello,
I am generating a template that contains a dynamic button panel, and I need to assign a click event to an <a> element within a dynamically generated <li> list. I get the values from a Json object.
The function value of each element of the list comes from a Json object value (fieldChildren.action), but when trying to assign the event (click)="fieldchildren.action", it is not being created correctly.
Please help me with some indication in this regard.
I am using kendo multistep form with angular 15
<ul ngbDropdownMenu id="addoptions" aria-labelledby="Button_Add" class="dropdown-menu">
I'm struggling to access this kendo-switch ID (in this case it should be A1) being passed to the generateSubscriptionArray function it seems to return undefined no matter what variation of attempts to access it I try, it also doesn't seem to show up on the $event if I try to pass this to the function.
Any assistance regarding this would be really beneficial the switch is returning the relevant true/false boolean
HTML
<kendo-switch
onLabel=" "
offLabel=" "
formControlName="A1"
id="A1"
(click)="generateSubscriptionArray(userPreferenceForm.controls.A1.value,
formcontrol id as string in this case A1 should be passed here)"
></kendo-switch>
TypeScript:
exportclass UserPreferencesComponent implements OnInit {
userPreferenceForm: FormGroup;
email_address: FormControl;
constructor() {}
ngOnInit(): void {
this.userPreferenceForm = new FormGroup({
email_address: new FormControl('', Validators.required),
A1: new FormControl(false),
});
}
generateSubscriptionArray = (subscription: boolean, alertID: string): void => {
if (subscription === true) {
console.log(subscription, alertID);
} else {
console.log(subscription, alertID);
}
};
I am new at Kendo UI. Already I add the date module normally as a quick cli setup. But when I want to add another module this trough an error.
Example:
Unable to load package information from the registry: Response timeout while trying to fetch https://registry.npmjs.org/@progress%2fkendo-angular-inputs (over 300000ms)