-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Blazor and HMTX: form only get #3065
Comments
Hey, what URL do you see in your network inspector for that If the request is made to the current page, then it probably means htmx hasn't had the chance to initialize your form at all (making it therefore fallback to the native default behavior, i.e. If that's the case:
If that's not the case, please provide more information about that request (ideally, provide the whole request data, with headers and payload) Hope this helps! |
If you’re adding Blazor interactivity (Blazor.web.js) to the example, one thing to keep in mind is that Blazor will by default send fetch requests (enhanced navigation just like HTMX) to same-origin endpoints via GET, unless configured not to do so - manually opting out of enhanced navigation or building a Blazor-enhanced form. This is probably intercepting the behavior you’re expecting out of HTMX. If this isn’t enough, as Telroshan said, some additional details would help. |
@enrico-rossini-tracebit If all else fails, and you give up, I suggest adding a combination of AlpineJS and Hydro to a new Razor project. I'm assuming this project is brand new. Benefits of Razor x HTMX&Hydro + Alpine ('RazorHAT'):
Drawbacks:
I've gone thru learning Razor Pages, and it's really, really nice to have my project (re)load in < 250 ms in Hot Reload no matter how many nugets or random JS libs I use. If you want tips on how to do this, feel free to ask. Otherwise, I recommend searching htmx on Khalid A's blog, or starting with this guide, here Good luck, and have fun. |
I have a project in
.NET8
forASP.NET Core
. This project hasHTMX
. Now, I want to add Blazor to the solution. I have quite a simple page that mimics the example on GitHub.I added in the Program.cs the minimal APIs for this page. 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 aPOST
.Do you have any idea if this is related to a configuration of the project or something related to the HTMX working with Blazor?
The text was updated successfully, but these errors were encountered: