abundant-spring-38265
01/11/2023, 10:34 AM<form hx-post="{% url 'inventory:inventory_device_validation_state' %}" hx-trigger="click">
{% csrf_token %}
<div class="form-check form-switch">
{% if not device.validation_ready_state %}
<input class="form-check-input" name="validation_state" type="checkbox" value="{{ device.id }}-1" role="switch">
{% else %}
<input class="form-check-input" name="validation_state" type="checkbox" value="{{ device.id }}-0" role="switch" checked>
{% endif %}
</div>
</form>
abundant-spring-38265
01/11/2023, 10:35 AMboundless-vase-80440
01/11/2023, 10:49 AMprehistoric-garden-45720
01/11/2023, 12:42 PMlate-king-98305
01/11/2023, 1:34 PMonClick
event handler, looking up that element's checked
attribute will return false
. They aren't as intuitive as we would think they should be! As you noted, if you click it enough, you do end up getting the toggle behavior, but I would bet that if you were to query the state of that checkbox, it would be the opposite of what you expected.late-king-98305
01/11/2023, 1:36 PMmysterious-toddler-20573
01/11/2023, 2:47 PMmysterious-toddler-20573
01/11/2023, 2:47 PMjs://
orange-umbrella-16693
01/11/2023, 2:53 PMjavascript:
, like for anchor tags, or would that be too confusing?gorgeous-airport-54386
01/11/2023, 2:56 PMadventurous-ocean-93733
01/11/2023, 3:15 PMadventurous-ocean-93733
01/11/2023, 3:18 PMjs://
isn't a valid URI schememysterious-toddler-20573
01/11/2023, 4:52 PMjs://
was the valid URI scheme, but we should do what the standard & HTML supportsbrash-machine-54411
01/11/2023, 5:30 PMboundless-vase-80440
01/11/2023, 5:30 PMboundless-vase-80440
01/11/2023, 5:31 PMbrash-machine-54411
01/11/2023, 5:31 PMboundless-vase-80440
01/11/2023, 5:32 PMboundless-vase-80440
01/11/2023, 5:33 PMsalmon-oil-67352
01/11/2023, 5:38 PMhtmx.on('htmx:beforeSwap', (event) => {
if (event.detail.target.id == 'main_content') {
htmx.config.scrollBehavior = 'auto';
htmx.config.defaultSettleDelay = 0;
}
})
It does work! Thanks!!mysterious-toddler-20573
01/11/2023, 5:50 PMmysterious-toddler-20573
01/11/2023, 5:51 PMsalmon-oil-67352
01/11/2023, 6:11 PMmysterious-toddler-20573
01/11/2023, 6:17 PMorange-umbrella-16693
01/11/2023, 6:52 PMhtml
<div id="element1"><p>I'm new content</p></div>
<img id="image1" src="/path_to/newimage.png">
boundless-vase-80440
01/11/2023, 8:09 PMorange-umbrella-16693
01/11/2023, 8:12 PMorange-umbrella-16693
01/11/2023, 8:12 PM