I can't send data to a websocket (I get a standard form submit) #900
-
Hello! This is happening with htmx v1.7.0 I'm trying to implement a simple websocket. On the htmx side I have this code: <div hx-ext="ws" ws-connect="/someurl">
<div id="content-to-be-replaced"></div>
<form ws-send>
<input name="test">
</form>
</div> Data coming from the server works correctly and is placed in the appropriate div. The problem is that the form is submitted as a GET form instead of having the data sent to the socket. This is another test from a user on the discord server who noticed my same issue: <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<script src="https://unpkg.com/htmx.org@1.7.0"></script>
<script src="https://unpkg.com/htmx.org@1.7.0/dist/ext/ws.js" ></script>
</head>
<body>
<script>
htmx.logAll();
</script>
<div hx-ext="ws" ws-connect="wss://demo.piesocket.com/v3/channel_1?api_key=VCXCEuvhGcBDP7XhiJJUDvR1e1D3eiVjgZ9VRiaV¬ify_self">
<div id="chat_room">
...
</div>
<form ws-send>
<input name="chat_message">
</form>
</div>
</body>
</html> Am I doing something wrong? Do I have to add something to prevent the default form submission? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I was answered on the discord server and this has been fixed on dev :) |
Beta Was this translation helpful? Give feedback.
I was answered on the discord server and this has been fixed on dev :)