In the Prompt dialog, difference between clicking Cancel and OK with nothing entered

1 Answer 211 Views
Dialog
Doug
Top achievements
Rank 1
Iron
Iron
Veteran
Doug asked on 20 Sep 2021, 03:03 PM

The documentation states, "The prompt dialog returns a string that the user enters when they press OK, and null when they press Cancel."

However I've discovered that null is returned when the user clicks cancel, and also when they click OK without entering anything. So I can't tell whether they clicked OK or cancel. If they click OK without entering anything, that's not valid in my scenario but I can't tell whether to validate it because maybe they clicked cancel.

Any way to determine which button was clicked?

 

1 Answer, 1 is accepted

Sort by
0
Nadezhda Tacheva
Telerik team
answered on 22 Sep 2021, 08:48 AM

Hello Doug,

Indeed, at this stage pressing Cancel or OK with an empty textbox cannot be differentiated as the returned result is null in both cases. OK with an empty textbox should return string.Empty.

The following bug report in our public feedback portal covers this scenario - Differentiate Cancel and OK with an empty textbox. I see you already voted for it, you may also follow it to keep in track with its progress.

If any further questions appear, please do not hesitate to contact us. Thank you for choosing Telerik UI for Blazor!

Regards,
Nadezhda Tacheva
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
Doug
Top achievements
Rank 1
Iron
Iron
Veteran
Answers by
Nadezhda Tacheva
Telerik team
Share this question
or