mysterious-toddler-20573
04/09/2022, 12:33 AMblue-gold-89534
04/09/2022, 12:34 AMmysterious-toddler-20573
04/09/2022, 12:34 AMmysterious-toddler-20573
04/09/2022, 12:35 AMhx-include down onto the savemysterious-toddler-20573
04/09/2022, 12:35 AMblue-gold-89534
04/09/2022, 12:39 AMblue-gold-89534
04/09/2022, 12:41 AMgorgeous-airport-54386
04/09/2022, 12:42 AMThis attribute can be [unset](/docs/#unset).rapid-umbrella-80895
04/09/2022, 10:47 AMeager-psychiatrist-68229
04/09/2022, 11:42 AMmysterious-toddler-20573
04/09/2022, 12:49 PMhx-trigger you should be able to check whatever you wantpowerful-eye-47205
04/09/2022, 3:22 PMpowerful-eye-47205
04/09/2022, 3:52 PMcareful-waiter-81326
04/09/2022, 7:13 PMcareful-waiter-81326
04/09/2022, 7:31 PM<FORM METHOD="POST" style="display: inline;" id="sel_wishlist" action="/buildsetr" name="sel_wishlist">
<select id="wishlist" name="wishlist"><option value="1">Default</option><option value="9">list1</option><option value="12">list2</option><option value="31">list3</option><option value="33">list4</option></select>
<input id="submit1" name="submit1" type="submit" value="Update current">
</FORM>
and way farther in the page I have a list of part in a table, where I have this button
<td style="text-align:center;">
<form id="form-{{part.invid.data}}"" hx-get=" /addtowish" hx-target="#addqt-{{part.invid.data}}" hx-vals='{ "test": wishlist }'>
{{ part.partidh }}
{{ part.colid }}
{{ part.tobuy(style="width:55px; text-align: center;",oninput="this.value=
['','-','+'].includes(this.value) ? this.value : this.value|0") }}
<br>
<button>Add to wishlist</button>
<br><span id="addqt-{{part.invid.data}}"></span>
</form>
</td>
My goal is to pass the value of the selected <select id="wishlist" name="wishlist"> in the <button>Add to wishlist</button>careful-waiter-81326
04/09/2022, 7:32 PMcareful-waiter-81326
04/09/2022, 7:50 PM<td style="text-align:center;">
<form id="form-{{part.invid.data}}"" hx-get=" /addtowish" hx-target="#addqt-{{part.invid.data}}" hx-vals='js:{ "wishlist": document.getElementById("wishlist").value }'>
{{ part.partidh }}
{{ part.colid }}
{{ part.tobuy(style="width:55px; text-align: center;",oninput="this.value=
['','-','+'].includes(this.value) ? this.value : this.value|0") }}
<br>
<button>Add to wishlist</button>
<br><span id="addqt-{{part.invid.data}}"></span>
</form>
</td>rapid-umbrella-80895
04/09/2022, 10:15 PMclean-vegetable-65167
04/11/2022, 9:41 AMmysterious-toddler-20573
04/11/2022, 10:54 AMrequestConfig which, internally, should contain the triggeringEvent which should contain the original triggering element.lively-coat-67211
04/11/2022, 11:11 AM<select name="test_name" class="select" hx-post="/hx_test_url/" hx-target="#test_targer"> This will post when the user makes a selection, but I'd like to manually trigger this via an event in javascript. Is it even possible to trigger a HTMX POST via an event rather than from an element on the page?mysterious-toddler-20573
04/11/2022, 11:13 AMmysterious-toddler-20573
04/11/2022, 11:14 AMchange, my-custom-eventclean-vegetable-65167
04/11/2022, 11:14 AMmysterious-toddler-20573
04/11/2022, 11:20 AMmysterious-toddler-20573
04/11/2022, 11:20 AMmysterious-toddler-20573
04/11/2022, 11:21 AMmysterious-toddler-20573
04/11/2022, 11:21 AMhtml
<script src="https://demo.htmx.org"></script>
<select id="select" name="opt"
hx-get="/demo"
hx-target="#output"
hx-trigger="change, myEvent">
<option>Option1</option>
<option>Option2</option>
<option>Option3</option>
</select>
<br/>
<button onClick="htmx.trigger('#select', 'myEvent')">
Send Request
</button>
<br/>
<output id="output">
</output>
<script>
var request = 0;
</script>
<template url="/demo">
Request: ${request++} value: ${opt}
</template>mysterious-toddler-20573
04/11/2022, 11:21 AM