# htmx forms and Astro View Transitions

> Learn how to fix htmx forms that break when you enable Astro View Transitions by adding the data-astro-reload attribute so the page does not reload early.

Author: [Flavio Copes](https://flaviocopes.com/about/) | Published: 2023-12-20 | Topics: [Astro](https://flaviocopes.com/tags/astro/), [htmx](https://flaviocopes.com/tags/htmx/) | Canonical: https://flaviocopes.com/htmx-forms-and-astro-view-transitions/

I already wrote about [htmx and Astro View Transitions](https://flaviocopes.com/htmx-and-astro-view-transitions/).

But I've got a new tip to work with forms.

Had this issue today with a form controlled by htmx (htmx sends a POST request when this form is submitted) that was working fine until I enabled View Transitions on the site (built with [Astro](https://flaviocopes.com/astro-introduction/)).

I was POSTing data to a URL like `/api/project/:project_id` and expected the returned HTML of this POST request to be shown in the place I wanted to, but turns out View Transitions automatically trigger a page transition and that reloads the current page:

![Browser developer tools showing network requests where page reload interrupts htmx form submission](https://flaviocopes.com/images/htmx-forms-and-astro-view-transitions/1.webp)

So basically my page refreshed before htmx could handle the response from the server. I was a bit confused until I analyzed carefully my requests log server-side.

Adding `data-astro-reload` to the forms fixed the problem.
