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

    late-king-98305

    07/01/2022, 12:39 AM
    Are there any new attributes / values for 1.8? I'll want to make sure my library includes them if there are.
  • p

    powerful-army-90860

    07/01/2022, 2:42 AM
    No I haven't gotten this working yet - admittedly I have focused on some other things since posting this. Is the issue because it's in a bootstrap modal? I am hosting the htmx js locally - it's not loaded deferred from a CDN
    m
    • 2
    • 1
  • r

    refined-waiter-90422

    07/01/2022, 3:02 AM
    github is codemonkeys tik tok
  • a

    ancient-father-3063

    07/01/2022, 5:36 AM
    So I've got 5 form fields that all have the same htmx:
  • a

    ancient-father-3063

    07/01/2022, 5:37 AM
    Copy code
    py
    'hx-trigger': 'change, load', 'hx-get': '/listofflavors', 'hx-target': 'next select', 'hx-swap': 'innerHTML'
  • a

    ancient-father-3063

    07/01/2022, 5:37 AM
    But... I actually only want them to trigger if they have a value
  • a

    ancient-father-3063

    07/01/2022, 5:37 AM
    When the page loads, some of the form selects have a value selected, others do not.
  • a

    ancient-father-3063

    07/01/2022, 5:38 AM
    (these forms are dropdown selects, if that matters)
  • a

    ancient-father-3063

    07/01/2022, 5:38 AM
    Any ideas?
  • b

    brainy-ice-92385

    07/01/2022, 8:15 AM
    This sounds like a job for a custom event hx-trigger and some hyperscript which checks the status on init and only triggers the custom event in the case you want
  • a

    ancient-father-3063

    07/01/2022, 8:54 AM
    Do you know anywhere I could see an example of something like that @brainy-ice-92385 ? I'm kinda new to this whole thing
  • e

    eager-tiger-27508

    07/01/2022, 9:08 AM
    Here's a good start: https://htmx.org/headers/hx-trigger/
  • m

    most-jelly-15242

    07/01/2022, 10:57 AM
    No I haven t gotten this working yet
  • s

    some-diamond-25050

    07/01/2022, 11:04 AM
    when I used form with a submit button in custom modal dialog example which has its close button on clicking close I am expecting to just dismiss dialog but its causing form submit. https://github.com/bigskysoftware/htmx/discussions/951
  • j

    jolly-kite-167

    07/01/2022, 12:59 PM
    gists maybe
  • m

    mysterious-toddler-20573

    07/01/2022, 1:29 PM
    hard to say, but maybe the trigger filter feature will work here?
  • a

    ancient-father-3063

    07/01/2022, 2:24 PM
    looking at the docs, that sounds exactly like what I need, but none of the examples cover my case.
  • a

    ancient-father-3063

    07/01/2022, 2:25 PM
    It's a select element
  • a

    ancient-father-3063

    07/01/2022, 2:25 PM
    and I just want to check if it has any value
  • a

    ancient-father-3063

    07/01/2022, 2:25 PM
    so I want to exclude the ones that are empty
  • a

    ancient-father-3063

    07/01/2022, 2:28 PM
    Copy code
    html
    <div hx-get="/clicked" hx-trigger="click[checkGlobalState()]">Control Click Me</div>
  • a

    ancient-father-3063

    07/01/2022, 2:28 PM
    this is probably closest. I could make a global function that checks if the select has a value?
  • g

    gorgeous-ghost-95789

    07/01/2022, 2:44 PM
    Answers posted on GitHub 😀
  • a

    abundant-spring-38265

    07/01/2022, 2:49 PM
    Hey guys, should hx-indicator "hide" the img object until response is received? Mine seems to be displayed regardless :/
  • a

    abundant-spring-38265

    07/01/2022, 2:50 PM
    <form hx-post="/device_run_command" hx-target="#command_output" hx-indicator="#loader_bars" nunjucks-template="template_of_cmd_output"> <img id="loader_bars" alt="Loading..." src="{{url_for('static', filename='bars.svg')}}" width="16px" height="16px" />
  • l

    late-king-98305

    07/01/2022, 5:18 PM
    hx-indicator
    puts an
    htmx-request
    class on the element specified there; you'll want to define styles for that element both with the class (visible) and without (probably hidden). The example on that attribute is pretty good. https://htmx.org/attributes/hx-indicator/ (Doing it via adding and removing a class lets you use animations / transitions if you want; but, if you just want it to toggle between
    display: none
    and
    display: inline-block
    , that will work as well.)
  • p

    powerful-train-54786

    07/01/2022, 11:22 PM
    Hi, I'd like a bit of guidance as to the most ideomatic solution for a feature in my app. I have a pane that I'm going to allow the user to add different editable content boxes like a header textbox, a paragraph textarea, list text boxes etc. There will be a plus button and as the user adds the items from a pop-up hovering over the button, a new input component gets pushed on the list, bringing the plus button down. The obvious htmx solution I can think of is just have those components as the response from different get endpoints, and have them be appended to a target form.
    • 1
    • 1
  • p

    powerful-train-54786

    07/01/2022, 11:50 PM
    Hi I d like a bit of guidance as to the
  • f

    fancy-elephant-10660

    07/02/2022, 11:35 AM
    I'm breaking my head on something simple. Where I can't find an example for. I got small form with 1 input field. If you submit something then something is added to a list. But onSubmit or after swap I want the form to be empty again. I could do this with JS but that is overkill. I don't see how to do it with htmx? can anybody give me some insight?
  • a

    ancient-father-3063

    07/02/2022, 11:43 AM
    When I use htmx to update the list of options on a select form field, this "change" doesn't trigger the hx-trigger="change" on that forms div.
1...732733734...1146Latest