Hi guys… I am stranding here. Using Turbo in Nodejs application. I created an own middleware to generate turbo-frame and turbo-stream elements. All working well on a server side.
However on a frontend side I have problems with forms. Here is an example HTML:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<script type="module">
import hotwiredTurbo from 'https://cdn.skypack.dev/@hotwired/turbo';
</script>
<title>Hulala</title>
</head>
<body>
<turbo-frame id="auth-forms" data-turbo-action="update">
<h2>Register</h2>
<form action="/auth/signup" method="post">
<label for="email">Email</label>
<input type="text" name="email" id="email" />
<label for="password">Password</label>
<input type="password" name="password" id="password" />
<input type="submit" />
</form>
<a href="/auth/frm/signin">Login</a>
<a href="/auth/frm/forgot">Forgot password</a>
</turbo-frame>
</body>
</html>
The GET requests all work as intended. The POST request of the form does not create proper request and no error is thrown. Tried adding data-turbo=“true” to the form attributes. Tried in Chrome, Firefox… Looked at it from all different angles, tried all the tricks from my book. It all comes to the problem on frontend. Don’t know how to make turbo library to generate request with proper request headers in case of a POST request. What is there I am no seeing? What am I missing?
Sincerely thanks for any advice.
Stefan