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

    late-king-98305

    07/15/2022, 4:12 PM
    Consider it done, and headed your way directly. 🙂
  • l

    late-king-98305

    07/15/2022, 4:22 PM
    I wonder if it works for projects that don't use `package.json`; that would be "the majority of my projects"... LOL
  • l

    late-king-98305

    07/15/2022, 4:22 PM
    (I'm looking...)
  • r

    ripe-action-67367

    07/15/2022, 4:32 PM
    I have not found anything about manually installing web types on project level or ide level, so I assume no, it's not possible
  • q

    quiet-angle-80724

    07/15/2022, 5:01 PM
    Good day, everyone! Glad to be back here and see htmx getting so much attention nowadays. But I am still in the beginning of the road learning it. So need some help once again) I am trying to make a filter form with htmx. It consists of two selects and one input[type=text]. When any of those fields change, the form should be submitted with htmx. I found a way to do it putting
    hx-trigger='change'
    on the form tag. It works... but It only detects change on input[type=text] when it looses focus. But I need the change on wrapper form to be triggered when
    keyup changed delay:500ms
    type of thing happens on input[type=text]. How can I do it? Please share your knowledge!
  • m

    mysterious-toddler-20573

    07/15/2022, 5:05 PM
    I would keep things on the form and then add another
    hx-get
    on the input, with the
    hx-trigger
    set to the keyup event you have. You will need to use
    hx-include
    to include the form as well, if it is in fact a
    GET
    . (If it is a non-GET the closest enclosing form is automatically included)
  • q

    quiet-angle-80724

    07/15/2022, 5:10 PM
    Cool! How do I it? Something like
    hx-include="closest form
    ?
  • m

    mysterious-toddler-20573

    07/15/2022, 5:21 PM
    yep
  • a

    ancient-shoe-86801

    07/15/2022, 8:35 PM
    any luck?
  • l

    late-king-98305

    07/15/2022, 8:36 PM
    None yet. I got distracted with day-job ASAP stuff. :/
  • a

    ancient-shoe-86801

    07/15/2022, 11:55 PM
    Ok, I just confirmed that it works on PyCharm. I added a
    package.json
    file to the root of a flask project, also the htmx web types file, and the IDE seems to pick it up automatically;
  • a

    ancient-shoe-86801

    07/15/2022, 11:55 PM
    the
    package.json
    file being a minimal
    Copy code
    {
      "name": "gdm-hw-planner",
      "version": "1.0.0",
      "dependencies": {},
      "web-types": "./htmx-web-types.json"
    }
  • a

    ancient-shoe-86801

    07/15/2022, 11:56 PM
    a bit of a bummer having to create a couple of json files just for IDE support. Hopefully one day we have a plugin instead.
  • a

    ancient-shoe-86801

    07/16/2022, 12:01 AM
    also nice and sweet autocompletion:
  • s

    square-flower-1282

    07/16/2022, 12:29 AM
    no barriers to a plugin other than someone with free time?
  • l

    late-king-98305

    07/16/2022, 2:57 AM
    Thank you so much, @ancient-shoe-86801 - I will give that a shot!
  • h

    helpful-holiday-72672

    07/16/2022, 11:37 AM
    hey guys i wanna build something like https://checksocks5.com/ using htmx, however, ive ran into the issue where i dont see how to do a request and append to the text in a div based off the response, ive looked a little over the docs. just cant learn that way, if someones willing to walk me through it it be great!
  • r

    ripe-action-67367

    07/16/2022, 12:00 PM
    Look into hx-swap attribute, https://htmx.org/attributes/hx-swap/, specifically beforeend and afterbegin values
  • h

    helpful-holiday-72672

    07/16/2022, 12:10 PM
    thank you!!!
  • h

    helpful-holiday-72672

    07/16/2022, 12:12 PM
    ok i see the beforeend and afterbegin, but how do i run the task for each line individually? placing the line in the get response after the ?data=
  • r

    ripe-action-67367

    07/16/2022, 12:25 PM
    Sorry, i'm not sure that I follow. What tasks do you need to run? What lines?
  • h

    helpful-holiday-72672

    07/16/2022, 12:27 PM
    For each line in a proxylist I want to send a get request to my backend where it'll check and return a string
  • r

    ripe-action-67367

    07/16/2022, 12:31 PM
    ok, I see. There are some options. The easiest one would probably be just sending the content of the form and letting the server to parse the lines. That would mean that the result would have to be sent as one response as well
  • h

    helpful-holiday-72672

    07/16/2022, 12:32 PM
    Yeah I could do that but for 10 lines even it could take longer then the browser fails the request
  • r

    ripe-action-67367

    07/16/2022, 12:33 PM
    I'm not sure that htmx allows to process multiple requests from a single form, unfortunately. It is possible to send multiple requests by hooking into htmx events https://htmx.org/reference/#events, but then you would have to swap it somehow, and that may be tricky
  • h

    helpful-holiday-72672

    07/16/2022, 12:33 PM
    So your saying straight ajax would be the way to go
  • r

    ripe-action-67367

    07/16/2022, 12:34 PM
    If the requirement is that you have to use single field to send multiple requests, then probably yes
  • h

    helpful-holiday-72672

    07/16/2022, 12:34 PM
    Gonna suck, I don't know any JS 😂
  • r

    ripe-action-67367

    07/16/2022, 12:35 PM
    Admittedly, I've never had such case and never tried to implement it, but from my previous experience and knowing how htmx works under the hood, this is my best assumption
  • h

    helpful-holiday-72672

    07/16/2022, 12:35 PM
    Ok 🙏 thank you
1...748749750...1146Latest