Unplanned
Last Updated: 25 Aug 2021 07:26 by ADMIN
Christian
Created on: 23 Jul 2021 14:40
Category: Form
Type: Bug Report
4
Boolean FormItem does not trigger model and dynamic form updates

Here is a TelerikForm with a FormItem (1) for a boolean field. Another FormItem (2) should render, depending on the boolean field (1). This does not work with a TelerikForm, but works with a standard EditForm.

The workaround for a TelerikForm is to use a FormItem Template with a TelerikCheckBox. This is demonstrated below as well.

<EditForm Model="@_data">
    <label>Condition 1 (InputCheckbox):</label>
    <InputCheckbox @bind-Value="@_data.Value1" />
    <br />
    @if (_data.Value1)
    {
        <label>Result 2</label>
        <InputCheckbox DisplayName="Result 2:" @bind-Value="@_data.Value2"></InputCheckbox>
    }
</EditForm>

<h1>TelerikForm</h1>

<TelerikForm Model="@_data">
    <FormItems>
        <FormItem LabelText="Condition 1 (FormItem):" Field="@nameof(_data.Value1)"></FormItem>
        <FormItem>
            <Template>
                <label for="x">Condition 1 (TelerikCheckBox):</label>
                <br />
                <TelerikCheckBox Id="x" @bind-Value="_data.Value1" />
            </Template>
        </FormItem>
        @if (_data.Value1)
        {
            <FormItem LabelText="Result 2:" Field="@nameof(_data.Value2)"></FormItem>
        }
    </FormItems>
</TelerikForm>

@code {
    private ExampleDto _data { get; set; } = new ExampleDto();

    public class ExampleDto
    {
        public string TextValue { get; set; }
        public bool Value1 { get; set; }
        public bool Value2 { get; set; }
    }
}

3 comments
ADMIN
Dimo
Posted on: 25 Aug 2021 07:26

Hello Anders,

Thanks for sharing your point of view and I am sorry to find out that the workaround will cost you additional development time. I bumped the priority of this request in our backlog.

Regards,
Dimo
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Anders
Posted on: 25 Aug 2021 07:19

I hope this bug will get a high priority.
We're using a lot of Telerikforms around our system and if we have to use the workaround. Would set us back a week at least.

Just glad it got found

 

Regards

Anders

ADMIN
Dimo
Posted on: 23 Jul 2021 15:00

Hi Christian,

Thanks for your cooperation in detecting this problem. The bug is now confirmed and awaits prioritization for fixing in a future product version.

In the meantime, I hope the workaround with the FormItem Template with a TelerikCheckBox is a feasible option.

Regards,
Dimo
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.