This is a migrated thread and some comments may be shown as answers.

TelerikButton

3 Answers 113 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
khashayar
Top achievements
Rank 1
Veteran
khashayar asked on 02 Jan 2020, 01:55 PM

hello,

TelerikButton is not working correct with EditForm 
when i use

       <input type="submit" class="btn btn-primary" value="Save" />
instead of 
<TelerikButton ButtonType="@ButtonType.Submit">Save</TelerikButton>
im able to submit the form with hitting enter
i want this feature with TelerikButton 

3 Answers, 1 is accepted

Sort by
0
Kristian
Telerik team
answered on 02 Jan 2020, 04:01 PM

Hi Khashayar,

I created a simple project to test the problem but I couldn't reproduce it. I'm attaching a short video that I recorded during my test. Please let me know if I'm following the correct steps in the video.

Can you please try to apply the code to your business logic and tell me if it works as expected?

Here is the code I used:

@using System.ComponentModel.DataAnnotations

<EditForm Model="@validationModel" OnValidSubmit="@HandleValidSubmit" OnInvalidSubmit="@HandleInvalidSubmit">
    <DataAnnotationsValidator />
    <ValidationSummary></ValidationSummary>

    <InputNumber @bind-Value="@validationModel.AgeInYears"></InputNumber>

    <TelerikButton>Submit</TelerikButton>
</EditForm>

<p>
    @SuccessMessage
</p>


@code {
    class NumericValidationModel
    {
        [Required(ErrorMessage = "Enter an int age")]
        [Range(0, 200, ErrorMessage = "Nobody is that old")]
        public int? AgeInYears { get; set; }
    }

    NumericValidationModel validationModel = new NumericValidationModel();

    string SuccessMessage = string.Empty;

    void HandleValidSubmit()
    {
        SuccessMessage = "Form Submitted Successfully!";
    }

    void HandleInvalidSubmit()
    {
        SuccessMessage = "";
    }
}

 

If you have any questions, let me know.

 

Regards,
Kristian
Progress Telerik

 UI for Blazor
0
khashayar
Top achievements
Rank 1
Veteran
answered on 05 Jan 2020, 09:41 AM
thanks it helped so much 
but in a scenario 
you first enter your name in a TelerikTextBox
then lets say you select your gender with TelerikDropDownList
now if you hit enter form wont be submitted
0
Accepted
Marin Bratanov
Telerik team
answered on 06 Jan 2020, 05:05 PM

Hello,

Thank you for the clarification. This is something we will be working on as part of the keyboard support in the components. Hopefully, this particular scenario will also be handled in our upcoming release that will ship this feature. If it does not make it now, it will be available in a later release, we definitely have it on our radar. In the meantime, you will be able to use the Tab key to focus the button and press Enter to invoke it.

 

Regards,
Marin Bratanov
Progress Telerik

 UI for Blazor
Tags
General Discussions
Asked by
khashayar
Top achievements
Rank 1
Veteran
Answers by
Kristian
Telerik team
khashayar
Top achievements
Rank 1
Veteran
Marin Bratanov
Telerik team
Share this question
or