Completed
Last Updated: 31 May 2022 07:49 by ADMIN
Release 3.4.0
Joe
Created on: 23 May 2022 21:12
Category: TabStrip
Type: Bug Report
0
The arrow buttons are Scrollable Tabs are submit buttons
When setting the Blazor Tab control to Scrollable="true" the arrow buttons are set to be submit buttons.  This has a major problem in submitting a form they are embedded in, and there is no need for them to be submit button.  When manually edited to change them to not be submit buttons they operate as expected.
Attached Files:
1 comment
ADMIN
Dimo
Posted on: 30 May 2022 13:02

Hello Joe,

Thank you for reporting this issue. You are right that the tab scroll buttons don't need to be submit buttons. We are already working on this and our next release (in a few weeks) will include the fix.

I awarded you some Telerik points.

A possible workaround is to change the type of the TabStrip buttons with JavaScript.

@inject IJSRuntime js

@using System.ComponentModel.DataAnnotations

<TelerikForm Model="@person" Width="300px">
    <FormValidation>
        <DataAnnotationsValidator />
    </FormValidation>
    <FormItems>
        <FormItem Field="@nameof(Person.FirstName)" />
        <FormItem>
            <Template>
                <TelerikTabStrip Scrollable="true"
                                 Width="300px"
                                 TabPosition="Telerik.Blazor.TabPosition.Top">
                    @{
                        for (int i = 1; i <= 10; i++)
                        {
                            <TabStripTab Title="@("Tab " + i.ToString())" @key="@i">
                                Tab content.
                            </TabStripTab>
                        }
                    }
                </TelerikTabStrip>
            </Template>
        </FormItem>
    </FormItems>
</TelerikForm>

@* suppress-error allows script tags in Razor components. Move this script to an external JS file in production *@
<script suppress-error="BL9992">//
    function changeButtonType() {
        setTimeout(function() {
            var tabstripButtons = document.querySelectorAll(".k-tabstrip-items-wrapper > .k-button");
            tabstripButtons.forEach(el => {
                el.type = "button";
            });
        }, 300);
    }
//</script>

@code {
    public Person person = new Person();

    public class Person
    {
        [Required]
        [MaxLength(20, ErrorMessage = "The first name should be maximum 20 characters long")]
        public string FirstName { get; set; }
    }

    protected override async Task OnAfterRenderAsync(bool firstRender)
    {
        if (firstRender)
        {
            await js.InvokeVoidAsync("changeButtonType");
        }

        await base.OnAfterRenderAsync(firstRender);
    }
}

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.