Override standard form submit behaviour

Hello,
I am building a WebAssembly application.
I have an "add booking" with only a date field.
I need to put two date components "from date" and "to date".
When user clicks submit button I must invoke a custom method thats inserts many booking on database.

Can I override the Form0Submit method?
Do I need to remove default submit button and put another button to invoke custom method?
Thanks in advance,
Mario

Hi @mgiammarco,

Maybe you can use controllers partial methods to execute additional code similar to Angular:
https://www.radzen.com/documentation/blazor/customizing-generated-application/

I explain better the model has only one field: date.
I need to pass two dates so I suppose I need a custom method to receive two parameters.
And I am worried if I can remove default form submit button.

You can extend the model with additional property not mapped to a database field and add a DatePicker bound to this property. The value of the new property will be submitted like all other values without anything extra.

I have followed your suggestion.
Unfortunately now submit button does nothing. Validators do nothing.
I am trying to debug with visualstudio but breakpoints do not work (or perhaps we do not reach form0submit method on client), so I am out of games.
Consider that apps compile and I found the date property and I have bounded it to my widget.

when I set a breakpoint I get an error like "no symbols are loaded for this document"

And anyway I do not want to run default logic:

    protected async System.Threading.Tasks.Task Form0Submit(BookGLearn.Models.Bookglearndb.Prenotazioni args)
    {
        try
        {
            var bookglearndbCreatePrenotazioniResult = await Bookglearndb.CreatePrenotazioni(prenotazioni:prenotazioni);
            UriHelper.NavigateTo("prenotazioni");
        }
        catch (System.Exception bookglearndbCreatePrenotazioniException)
        {
            NotificationService.Notify(new NotificationMessage(){ Severity = NotificationSeverity.Error,Summary = $"Error",Detail = $"Unable to create new Prenotazioni!" });
        }
    }

But my own custom logic that uses additional date field to do multiple insertions.

In this case you execute your own logic on Button Click instead Form Submit.