Jump to first failed validation and/or to top of form

I have a long form, I need to jump to the top of the page if it fails validation and/or gives an error.

Right now, I hit the save button and nothing happens and the user doesn't know why nothing happened.

Ideas?

Hi @Chad,

You can probably handle the InvalidSubmit event of the form and display some notification that there are errors.

1 Like

Thank you.

Is there a place I can put this such that it will be available for all pages?

    protected async Task FailedValidation()
    {
        await DialogService.Alert("Review form for required fields");
    }

Hi @Chad,

You can create an extension method for the NotificationService class and then use it like this:

await DialogService.FailedValidation()
namespace <YourApplicationNamespace>
{
    public static class NotificationServiceExtensions
    {
       public satic async Task FailedValidation(this Radzen.DialogService dialogService)
       {
            await dialogService.Alert("Review form for required fields");
       }
    }
}
1 Like