hundreds-cartoon-20446
11/17/2022, 4:10 PMmysterious-toddler-20573
11/17/2022, 4:34 PMmysterious-toddler-20573
11/17/2022, 4:34 PMmysterious-toddler-20573
11/17/2022, 4:34 PMmysterious-toddler-20573
11/17/2022, 4:34 PMhundreds-cartoon-20446
11/17/2022, 4:42 PMboundless-vase-80440
11/17/2022, 4:53 PMboundless-vase-80440
11/17/2022, 4:55 PMmysterious-toddler-20573
11/17/2022, 4:56 PMmysterious-toddler-20573
11/17/2022, 4:59 PMmysterious-toddler-20573
11/17/2022, 4:59 PMboundless-vase-80440
11/17/2022, 5:25 PMboundless-vase-80440
11/17/2022, 5:26 PMhundreds-cartoon-20446
11/17/2022, 7:04 PMhx-history-preserve
to any container and the child nodes inside will be preserved in their original state for history restores.hundreds-cartoon-20446
11/17/2022, 7:07 PMsalmon-oil-67352
11/17/2022, 7:51 PMsalmon-oil-67352
11/17/2022, 7:57 PM<button
class="btn btn-success"
hx-get="{% url 'get_model_form' 'attribute_form' %}"
hx-target="#generic_modal_form_placeholder"
>
<i class="fas fa-plus"></i>
</button>
JS:
const modal = new bootstrap.Modal(document.getElementById('generic_modal_placeholder'))
htmx.on('htmx:afterSwap', (event) => {
if (event.detail.target.id == 'generic_modal_form_placeholder') {
modal.show()
}
}
)
salmon-oil-67352
11/17/2022, 8:00 PMmysterious-toddler-20573
11/17/2022, 8:04 PMform.reset()
and a bit of htmx for saving the contents, but it dependes a lot on the API. I haven't worked w/ bootstrap modals in forever though.salmon-oil-67352
11/17/2022, 8:09 PMsalmon-oil-67352
11/17/2022, 8:14 PMmysterious-doctor-98164
11/17/2022, 9:55 PM<form hx-post=/foo" hx-include="[name='mycheckbox']" hx-target="#target">
<sl-checkbox name="mycheckbox">Bar</sl-checkbox>
<button type="submit">Submit</button>
</form>
<div id="target"></div>
Using <input type="checkbox">
instead of <sl-checkbox>
works fine, sending {'mycheckbox': 'on'}
. Am I missing something simple (very likely, I'm pretty new to all this)?some-airline-73512
11/17/2022, 10:12 PMmysterious-toddler-20573
11/17/2022, 10:28 PMmysterious-toddler-20573
11/17/2022, 10:29 PMhtml
<div style="background-color:red;width:500px;height:300px;padding:12px;font-size:64px"
hx-trigger="doit"
hx-get="/example"
_="on mouseenter
wait for mouseout or 1s
if the result is not a MouseEvent
trigger doit">
Move mouse into me and wait a sec
</div>
mysterious-toddler-20573
11/17/2022, 10:38 PMechoing-action-55459
11/18/2022, 1:05 AMevent.stopImmediatePropagation()
😆mysterious-toddler-20573
11/18/2022, 3:53 AMgorgeous-airport-54386
11/18/2022, 3:54 AMmysterious-toddler-20573
11/18/2022, 3:59 AM