Declined
Last Updated: 23 Apr 2021 07:43 by ADMIN
Marc Simkin
Created on: 21 Apr 2021 17:49
Category: UI for Blazor
Type: Bug Report
0
Support attributes are inconsistent

The attributes that the Telerik Input components, FormItem, and FormGroup should all be consistent in the attributes that are supported.  For example, the TelerikSlider component doesn't support an Id property.  The FormGroup component doesn't support a Class property.

If I place the Slider inside a FormItem Template and provide my own label. I can't associate the label with the Slider since there is no Id property.

Also, if I am using a FormGroup to make sure that two input controls are shown horizontally install of vertically, I can't override the gray horizontal rule that shows with the group, especially when I am not providing LabelText.  I don't want to override this at the TelerikForm as I would like the default behavior in specific instances.

The attached screen shot highlights the issue.  Here is the razor component markup.  Note: Replace the custom RecSetSelector component with a dropdownlist.


@{
    var model = ViewModel.Model;
}

<TelerikForm EditContext="@EditContext"
             Columns="2"
             ColumnSpacing="20px"
             Orientation="FormOrientation.Vertical"
             OnValidSubmit="OnValidSubmit">
    <FormValidation>
        <FluentValidationValidator />
    </FormValidation>
    <FormItems>
        <FormGroup LabelText="Set options">
            <FormItem>
                <Template>
                    <label class="k-label k-form-label" for="setName">Set Name</label>
                    <TelerikTextBox Id="setName" @bind-Value="@model.SetName"></TelerikTextBox>
                </Template>
            </FormItem>
            <FormItem>
                <Template>
                    <TelerikDateRangePicker @bind-StartValue="@model.StartDate"
                                            @bind-EndValue="@model.EndDate"
                                            Min="@ViewModel.MinStartDate"
                                            StartId="startDate"
                                            EndId="endDate"
                                            DisabledDates="@ViewModel.DisabledDates">
                    </TelerikDateRangePicker>
                </Template>
            </FormItem>
            <FormGroup Columns="2">
                <FormItem>
                    <Template>
                        <label class="k-label k-form-label" for="allowAutoFill">Allow Auto Fill</label>
                        <TelerikCheckBox Id="allowAutoFill" @bind-Value="@model.AllowAutoFill"></TelerikCheckBox>
                    </Template>
                </FormItem>
                <FormItem Field="@nameof(model.RequiredRecsToExpire)">
                    <Template>
                        <label class="k-label k-form-label">Required Recs to Expire</label>
                        <TelerikSlider @bind-Value="@model.RequiredRecsToExpire"
                                       Min="0"
                                       Max="20"
                                       SmallStep="1"
                                       LargeStep="5"
                                       ShowButtons="false"/>
                    </Template>
                </FormItem>
            </FormGroup>
        </FormGroup>
        <FormGroup LabelText="Initial starting point">
            <FormItem LabelText="existingSets">
                <Template>
                    <label class="k-label k-form-label" for="existingSets">From existing recommendation sets:</label>
                    <RecSetSelector AvailableSets="@ViewModel.AvailableSets"
                                    IsNew="true"
                                    SelectedSetId="@ViewModel.SelectedSetId"
                                    OnSetSelected="@OnSetSelected" />
                </Template>
            </FormItem>
            <FormItem>
                <Template>
                    <label class="k-label k-form-label" for="eanList">From a list of EANs:</label>
                    <TelerikTextArea Id="eanList"
                                     @bind-Value="@ViewModel.EanList"
                                     AutoSize="true">
                    </TelerikTextArea>
                </Template>
            </FormItem>
        </FormGroup>
        <FormItem ColSpan="2" Field="@nameof(model.Comment)">
            <Template>
                <TelerikTextArea Id="comment"
                                 @bind-Value="@model.Comment"
                                 AutoSize="true">

                </TelerikTextArea>
            </Template>
        </FormItem>
        <ValidationSummary />
    </FormItems>
    <FormButtons>
        <div class="justify-content-end">
            <TelerikButton ButtonType="ButtonType.Button" OnClick="OnCancel">Cancel</TelerikButton>
            <TelerikButton ButtonType="ButtonType.Submit" Primary="true">Save</TelerikButton>
        </div>
    </FormButtons>
</TelerikForm>

1 comment
ADMIN
Marin Bratanov
Posted on: 23 Apr 2021 07:43

Hello Marc,

The FormItem and FormGroup are not input components and it cannot be expected that they will expose the full range of options an input or editor will.

If you have extremely complex forms, I can suggest you use a standard <EditForm> and design your layout as required - this will let you put any HTML, any CSS in any order you require, while still being able to plug our editor components to benefit from their power. The TelerikForm component is designed to let you create the basic scenario easily and quickly, but such automation always comes at a cost - for example, how far you can modify and extend such a feature before having to write things on your own. There are many cases where form layouts are rather straightforward, and our form caters to that, not to highly customized and stylized forms. For those, we offer individual components like validation messages tools and a variety of editors.

To get to the sliders - the Telerik sliders are a more complex HTML structure than a plain <input type="range">. They offer a ton of functionality it does not (like multiple handles, labels, orientation) and this cannot be achieved with a plain input. Therefore, you can't hook a <label> to it, because it is no longer an input. This is also why they don't have an ID - it is usually used for inputs-labels pairing, but that's not possible here.

What we have done is to enable keyboard navigation and tab order so the user can still use it with the keyboard.

So, with that in mind, I must mark this as "Declined" simply because there are technological requirements that make it impossible to have feature and parameter parity between all components we offer.

Lastly, I opened a new feature request on your behalf for a Class on the FormGroup - I think it can add value, and since the request was opened on your behalf, you are already subscribed for notifications. You can find it in this page: https://feedback.telerik.com/blazor/1516731-add-class-parameter-to-the-formgroup.

Regards,
Marin Bratanov
Progress Telerik

Тhe web is about to get a bit better! 

The Progress Hack-For-Good Challenge has started. Learn how to enter and make the web a worthier place: https://progress-worthyweb.devpost.com.