Heyyyyall,
Did anyone figure out a way to prevent default (and scroll to top) on calling actions using a form action in Astro?
This has been an issue for a while now π https://github.com/withastro/astro/issues/9488
---
import { actions } from "astro:actions";
const result = Astro.getActionResult(actions.getGreeting);
console.log({ result });
---
<form method="POST" action={actions.getGreeting}>
<input name="name" value="hey" />
<button>Submit</button>
{result?.error && <p class="error">Unable to sign up. Please try again later.</p>}
</form>
The solutions in th GH issue are valid, but I was hoping by now we have a nicer solution, instead of using <script> tags ππ»