Submit button in TelerikDialog are not working

1 Answer 56 Views
Dialog
Martin Herløv
Top achievements
Rank 2
Bronze
Iron
Iron
Martin Herløv asked on 13 Mar 2023, 08:11 AM

I have the following buttons

When I press enter nothing happens

<DialogButtons>
<TelerikButton OnClick="@(() => { IsModalVisible = false; })">Cancel</TelerikButton>
<TelerikButton OnClick="@(() => { IsModalVisible = false; CreateTrade();})" ButtonType="ButtonType.Submit" ThemeColor="@ThemeConstants.Button.ThemeColor.Primary">Create Trade</TelerikButton>
</DialogButtons>

1 Answer, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 14 Mar 2023, 12:13 PM

Hi Martin,

It looks like you want to submit a form. However, these Dialog buttons are not rendered inside a form. That's why Enter keypress has no effect.

Use the Id parameter of the form and the Form parameter of the Submit button to define a relationship between the two components. You will also need to close the Dialog explicitly on form submit.

If there is no Form in this scenario, then Enter keypress will work only if you focus any of the two buttons, or if you implement a custom @keydown handler for a container inside the Dialog content.

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.

Tags
Dialog
Asked by
Martin Herløv
Top achievements
Rank 2
Bronze
Iron
Iron
Answers by
Dimo
Telerik team
Share this question
or