Completed
Last Updated: 11 Nov 2023 08:41 by ADMIN
Release 5.0.0 (15 Nov 2023) (R1 PI1)
Robert
Created on: 08 Sep 2023 13:33
Category: Slider
Type: Bug Report
3
The Slider default button type is "submit", which causes an unexpected form submission

Why are the slider buttons of type 'submit' and how do I change them not to be?

 

===ADMIN EDIT===

Temporary solution:

@inject IJSRuntime js

<TelerikSlider @bind-Value="@SliderValue"
               Min="0"
               Max="100"
               SmallStep="1"
               LargeStep="20"
               Width="400px">
</TelerikSlider>

<script suppress-error="BL9992">
    window.changeButtonTypes = function () {
        var buttons = document.querySelectorAll(".k-slider button");
        for (var i = 0; i < buttons.length; i++) {
            buttons[i].type = "button";
        }
    };
</script>

@code {
    public int SliderValue { get; set; }

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

0 comments