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

    green-activity-6102

    09/24/2022, 1:49 AM
    can anyone tell me why the
    hx-trigger=keyup
    override on the
    #id_search
    field at the bottom is not working? it's still inheriting the
    change
    trigger from the parent form
    Copy code
    html
    <form hx-get="/explore" hx-target="#form-and-table" hx-trigger="change" id="filter-form" method="post" name="filter-form">
    
      <div id="div_id_location" class="mb-3">
    
        <label for="id_location" class="form-label">Location</label> 
        <select name="location" class="select form-select" id="id_location">
          <option value="">
            All
          </option>
    
        </select>
      </div>
    
      <div id="div_id_categories" class="mb-3">
    
        <label for="id_categories" class="form-label">Categories</label> 
        <select name="categories" class="selectmultiple form-select" id="id_categories" multiple>
          <option value="1">
            Hello World
          </option>
        </select>
    
      </div>
    
      <div id="div_id_search" class="form-floating mb-3">
        <input type="text" name="search" hx-trigger="keyup" class="textinput textInput form-control" placeholder="search" id="id_search"> <label for="id_search">Search</label>
      </div>
    
    </form>
    m
    • 2
    • 21
  • g

    green-activity-6102

    09/24/2022, 1:50 AM
    ive got 2 select fields that i want to trigger on
    change
    , but the third is a free-form text box that i want to trigger on
    keyup
  • g

    green-activity-6102

    09/24/2022, 1:50 AM
    this feels like a such a simple htmx use case, not sure why its not working
  • g

    green-activity-6102

    09/24/2022, 3:28 AM
    turns out if i copy the
    hx-get
    parameter down onto the search box it fixes this... is this a bug or intended behavior?
  • f

    freezing-waitress-26396

    09/24/2022, 6:57 AM
    Did you try
    <form hx-trigger="change from:<#id_search/> ..."
    ?
  • f

    freezing-waitress-26396

    09/24/2022, 7:01 AM
    https://htmx.org/attributes/hx-trigger/#:~:text=from,selector
  • f

    future-lizard-8818

    09/24/2022, 12:43 PM
    Hi everybody. Is there a a way how to get same behavior of "..." but with HTMX ??? (I want to be able - easily - to display indicator/spinner inside the link button meanwhile file gets generated on the server).
  • m

    mysterious-toddler-20573

    09/24/2022, 1:52 PM
    The best pattern I have come up with is to issue an hx-get and then doa client-side redirect to a download URL when the download is ready (although I've had issues w/ some browsers not honoring the redirect iirc)
  • f

    future-lizard-8818

    09/24/2022, 1:57 PM
    Thank you, that might be possible. But I'd also like to avoid storing generated file on server filesystem (or is there some simple way to have URL for "in memory" stored data objet in Django?)
  • f

    future-lizard-8818

    09/24/2022, 1:59 PM
    I was wondering if there is something like hx-swap="download" ;)) ... feature request ???
  • r

    refined-waiter-90422

    09/24/2022, 3:03 PM
    djangocon 2022 = htmxcon
  • g

    green-activity-6102

    09/24/2022, 4:16 PM
    the use case here is that i have a form and i want all of the select elements to use
    change
    but I want the free-text search box to use
    keyup
    -- intuitively i thought I could use
    hx-trigger=change
    on the
    <form>
    element then just override
    hx-trigger=keyup
    on the single input where i need it. Is this not the design intent?
  • a

    ancient-shoe-86801

    09/24/2022, 5:29 PM
    @mysterious-toddler-20573 in addition to (or in replacement of?) https://github.com/bigskysoftware/htmx/blob/master/editors/jetbrains/htmx.web-types, should we submit a PR to add it to https://github.com/JetBrains/web-types?
  • a

    ancient-shoe-86801

    09/24/2022, 5:35 PM
    although it seems that users still need to go to that repo and fetch the file if they want to use it. It is not that by submitting it here they get "auto-included" on IntelliJ IDEs. So if that's the case, might be not worth it having it on a separate repo. Related to that, I think it would be beneficial to have a "developer resources" (or just resources?) section on the docs, linking to that web-types files and how to use it on different editors, and probably also links to "htmx friendly" libraries.
  • a

    ancient-shoe-86801

    09/24/2022, 5:39 PM
    mmm, actually, it seems that info about that repo is included with PyCharm: https://github.com/rigogsilva/pycharm/blob/master/web-types-registry.xml need to leave now, but I'll check later what's the more user-friendly way to leverage that, to assess if it would be worth having the htmx web-types in there.
  • m

    mysterious-toddler-20573

    09/24/2022, 6:50 PM
    Do we have any contacts at JetBrains on here?
  • m

    mysterious-toddler-20573

    09/24/2022, 6:50 PM
    that's an interesting idea
  • m

    mysterious-toddler-20573

    09/24/2022, 6:50 PM
    are you willing to investigate it?
  • g

    gorgeous-airport-54386

    09/24/2022, 6:51 PM
    @hundreds-helicopter-5371 ?
  • a

    ancient-shoe-86801

    09/24/2022, 9:10 PM
    Ok, after reading the docs with more detail, it seems that the benefit of contributing to that repo is just: - Having a centralized place to look for web types. - They push them to npm as packages: https://www.npmjs.com/search?q=%40web-types But there isn't any real "automatic integration" gained by having them there. You can just manually create (copy) the web types JSON file on you project, create a package.json to point to it, and you are good to go. But it would be good if anybody from JetBrains could confirm.
  • f

    future-lizard-8818

    09/25/2022, 7:50 AM
    I'll try my best 😉
  • g

    green-activity-6102

    09/25/2022, 5:46 PM
    can anyone tell me why the `hx trigger
  • e

    early-camera-41285

    09/25/2022, 6:02 PM
    Is there a way to make an hx-get request immediately but wait to swap it into the dom? Make request and start timer, swap in response 1 second after request was made (if it is ready).
  • b

    bitter-monkey-50309

    09/25/2022, 6:07 PM
    Check out the
    swap
    modifier https://htmx.org/attributes/hx-swap/
  • g

    green-activity-6102

    09/25/2022, 6:16 PM
    i dont think hx-disinherit works at all...
  • g

    green-activity-6102

    09/25/2022, 6:16 PM
    i cant seem to make it work under any condition
  • e

    early-camera-41285

    09/25/2022, 6:31 PM
    Thanks, that is close, but the timing is based on the response. I'm interested in timing it based on the request.
  • m

    mysterious-toddler-20573

    09/25/2022, 6:55 PM
    so you want the timer to start at request time and then say something like "don't swap in until at least this amount of time passes" correct?
  • e

    early-camera-41285

    09/25/2022, 7:03 PM
    Exactly. My use case is simple: I have a CSS page change animation that starts on click and I would love to sync the swap in with that click. I'm just hiding an expensive render
  • m

    mysterious-toddler-20573

    09/25/2022, 7:04 PM
    What do you want to happen if the request takes longer than the page change animation?
1...836837838...1146Latest