gorgeous-ghost-95789
03/11/2021, 8:54 PMgorgeous-ghost-95789
03/11/2021, 8:55 PMgentle-dream-18175
03/11/2021, 8:59 PMglamorous-honey-42686
03/11/2021, 10:21 PMmost-jelly-15242
03/11/2021, 10:24 PMglamorous-honey-42686
03/11/2021, 10:26 PMmysterious-toddler-20573
03/11/2021, 10:40 PMsalmon-whale-14625
03/12/2021, 3:37 AMhtmx:oobErrorNoTarget in the console with the following code:
html
<div hx-ws="connect:/tweet" hx-swap="afterEnd" hx-swap-oob="#timeline">
<form hx-ws="send:submit">
<div class="mb-3 row">
<label class="col-sm-2 col-form-label">Name:</label>
<div class="col-sm-10">
<input class="form-control" type="text" name="username" required="true">
</div>
</div>
<div class="mb-3 row">
<label class="col-sm-2 col-form-label">Message:</label>
<div class="col-sm-10">
<textarea class="form-control" rows="3" name="message" required="true"></textarea>
</div>
</div>
<div class="d-grid gap-2 col-3 mx-auto mb-3">
<button class="btn btn-primary text-center" type="submit">Tweet</button></div></form>
<div id="timeline"></div></div>mysterious-toddler-20573
03/12/2021, 4:13 AMmysterious-toddler-20573
03/12/2021, 4:14 AMmysterious-toddler-20573
03/12/2021, 4:14 AMmysterious-toddler-20573
03/12/2021, 4:14 AMhx-oob-swap='afterEnd'salmon-whale-14625
03/12/2021, 4:21 AMhtml
<div hx-swap-oob="afterbegin:#timeline">...</div>
It works now, but it is appending the response multiple times ( 3 times to be exact) I don't know this is a bug or notmysterious-toddler-20573
03/12/2021, 4:24 AMmysterious-toddler-20573
03/12/2021, 4:24 AMsalmon-whale-14625
03/12/2021, 4:24 AMthankful-addition-60522
03/12/2021, 6:41 AMfast-dream-13257
03/12/2021, 1:05 PMmysterious-toddler-20573
03/12/2021, 1:42 PMmysterious-toddler-20573
03/12/2021, 1:42 PMmysterious-toddler-20573
03/12/2021, 1:44 PMthankful-addition-60522
03/12/2021, 1:48 PMselect2 <script> on item, i wouldn't really be including it globally since it's used only on one endpoint, not in the whole app, right?thankful-addition-60522
03/12/2021, 1:50 PMthankful-addition-60522
03/12/2021, 1:50 PMmysterious-toddler-20573
03/12/2021, 1:51 PMthankful-addition-60522
03/12/2021, 1:53 PMhtml
<turbo-frame id="messages" src="/messages">
<p>This message will be replaced by the response from /messages.</p>
</turbo-frame>thankful-addition-60522
03/12/2021, 1:54 PMmysterious-toddler-20573
03/12/2021, 2:05 PMhtml
<div hx-trigger="doIt" id="messages" hx-get="/messages">
<p>This message will be replaced by the response from /messages.</p>
</div
and then triggered via javascript like this:
javascript
htxm.trigger("#messages", "doIt")mysterious-toddler-20573
03/12/2021, 2:05 PM