https://htmx.org logo
Join Discord
Powered by
# htmx-general
  • b

    boundless-vase-80440

    11/28/2022, 9:23 PM
    As a personal choice, I would not use the _format querystring param and instead expose something like /docs/table , /docs/select/ , /docs/1/card , etc.
  • d

    delightful-candle-13758

    11/28/2022, 10:06 PM
    Thanks for the two valuable inputs
  • l

    late-king-98305

    11/28/2022, 11:44 PM
    You can also check, on the server, for the presence of the
    HX-Request
    header. If it's there, the request came from htmx, and you could render the relevant partial; if it's not, you would render the full page. If you still want different URLs, though, the /docs/1/card pattern is really clean.
  • d

    delightful-candle-13758

    11/29/2022, 12:29 AM
    Thanks
  • m

    mysterious-doctor-98164

    11/29/2022, 2:33 AM
    This would work for shoelace form-controls (
    sl-input
    ) But not for other controls (
    sl-rating
    ,
    sl-checkbox
    , etc.). I'm not sure how the distinction works, but that's what shows up in my testing.
  • p

    prehistoric-smartphone-78535

    11/29/2022, 4:39 AM
    https://github.com/bigskysoftware/htmx/issues/764
  • p

    prehistoric-smartphone-78535

    11/29/2022, 4:39 AM
    Is there a fix to this problem?
  • p

    prehistoric-smartphone-78535

    11/29/2022, 4:39 AM
    Im trying to lazy load a video and it works perfectly on my PC but on my phone it doesnt
  • a

    ancient-father-3063

    11/29/2022, 5:07 AM
    Copy code
    <select class="select form-control" hx-ext="debug" hx-get="/listofarchetypes" hx-include="deckdoctor" hx-target="#id_archetype" hx-trigger="load, change" id="id_mtgFormat" name="mtgFormat" required=""> <option value="">---------</option> <option selected="" value="1">Legacy</option> <option value="2">Vintage</option>
    </select>
    So the hx-include part of this is not working, and I'm not sure why
  • a

    ancient-father-3063

    11/29/2022, 5:08 AM
    it is including the selected value, which is good. But I also want it to include the value for the div with the id 'deckdoctor'.
  • a

    ancient-father-3063

    11/29/2022, 5:08 AM
    can it not include two things, is that the problem?
  • p

    proud-dentist-32878

    11/29/2022, 7:24 AM
    Is this a known issue? I can't get
    hx-swap="none"
    to work. It just continues to swap in the content, on htmx version 1.8.4
  • p

    proud-dentist-32878

    11/29/2022, 7:54 AM
    As always. I made a mistake on my part!! htmx continues to be flawless!
  • b

    blue-ghost-19146

    11/29/2022, 8:03 AM
    hx-include=“#deckdoctor”
    - need the # symbol to specify it’s an id, right?
  • m

    mysterious-toddler-20573

    11/29/2022, 4:40 PM
    https://twitter.com/htmx_org/status/1597631036594491392
  • w

    white-motorcycle-95262

    11/29/2022, 5:08 PM
    What's the proper
    hx-trigger
    value for an
    input
    if I want "when enter is pressed and I'm focused"? e.g., I don't want it to fire for any/every "enter" press, only when the input is focused (e.g., they type something then press enter).
  • m

    mysterious-toddler-20573

    11/29/2022, 5:11 PM
    the hx-trigger is on the input?
  • w

    white-motorcycle-95262

    11/29/2022, 5:11 PM
    yeah
  • m

    mysterious-toddler-20573

    11/29/2022, 5:11 PM
    and is it within a form or not?
  • w

    white-motorcycle-95262

    11/29/2022, 5:11 PM
    no form
  • m

    mysterious-toddler-20573

    11/29/2022, 5:11 PM
    ok, then you won't need to worry about enter submitting the form
  • m

    mysterious-toddler-20573

    11/29/2022, 5:12 PM
    so you should be able to catch the
    keyup
    event and use a filter to check for the enter key
  • w

    white-motorcycle-95262

    11/29/2022, 5:12 PM
    and the fact that it's defined on the
    input
    means it won't catch other enter presses?
  • w

    white-motorcycle-95262

    11/29/2022, 5:13 PM
    I guess that's the difference between using .e.g,
    on keyup[enterKey]
    and
    on keyup[enterKey] from elsewhere
  • a

    abundant-spring-38265

    11/29/2022, 5:19 PM
    Guys, any way to get this to work, or my logic here is wrong?
    Copy code
    <div class="input-group">
    <select class="form-select form-select-sm" name="device">
        <option selected disabled>Select Device</option>
        {% for device in data.devices %}
        <option value="{{ device.id }}">{{ device.hostname }}</option>
        {% endfor %}
    </select>
    <select class="form-select form-select-sm" name="test">
        <option selected disabled>Select Test Type</option>
        {% for test in data.tests %}
        <option value="{{ test.id }}">{{ test.name }}</option>
        {% endfor %}
    </select>
    <button class="btn btn-sm btn-primary" type="submit" hx-get="/api/testing/dut/{{device.id}}/test_type/{{test.id}}">
        <i class="bi bi-cloud-upload-fill"></i> Push
    </button>
    </div>
  • a

    abundant-spring-38265

    11/29/2022, 5:20 PM
    initially this was a post form into Django view
  • a

    abundant-spring-38265

    11/29/2022, 5:20 PM
    but I now have an API endpoint doing the same thing so I'd like to use that instead
  • m

    mysterious-toddler-20573

    11/29/2022, 5:49 PM
    that looks reasonable, althoguh I would put the hx-get on the form rather than the button
  • m

    mysterious-toddler-20573

    11/29/2022, 5:50 PM
    yep, the event bubbles up to parents, but, within an input, it's only going to see keyups that occur within it
  • g

    green-activity-6102

    11/29/2022, 5:59 PM
    what do you mean by API endpoint here? Hopefully not a JSON API...?
1...925926927...1146Latest