Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

Blazor and HMTX: form only get

$
0
0

I have a project in ASP.NET Core 8. This project has HTMX. Now, I want to add Blazor to the solution. I have quite a simple page that mimics the example on GitHub.

<CascadingValue Value="ValidationResult"><form id="counter" hx-post="slacktest/ui" hx-swap="outerHTML"         hx-target="#counter"><HtmxAntiforgeryToken/><input type="hidden" id="check" value="@SlackForm.Check" /><input type="text" value="@SlackForm.SubscribeId"                name="@nameof(SlackForm.SubscribeId)"                class="form-control-plaintext w-100"/><label class="w-100">            Slack<InputText @bind-Value="SlackForm.WebhookUrl"                 name="@nameof(SlackForm.WebhookUrl)"/><HtmxValidationMessage For="() => SlackForm.WebhookUrl"/></label><button class="btn btn-primary">Click me</button></form></CascadingValue>@code {    [Parameter] public SlackUIModel SlackForm { get; set; } = new();    [Parameter] public ValidationResult ValidationResult { get; set; } = new();}

I added the minimal APIs for this page in the Program.cs. The issue is that every time I click the button, the request from the form is to the GET. There is no way to send a request as a POST.

Do you have any idea if this is related to a configuration of the project or something related to the HTMX working with Blazor?


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>