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

    mysterious-toddler-20573

    03/19/2023, 3:45 PM
    #1087038976210255994 ocamlites, rise up
  • g

    gray-morning-3453

    03/20/2023, 5:06 AM
    Any reason why my form does not get POSTed when empty or not valid (eg leaving a required field empty)? via this command:
    htmx.ajax('POST', '{% url "accounts:add" %}', {target:'body', swap: 'none', source: form});
    The same works fine if the form is filled and is valid
  • r

    refined-waiter-90422

    03/20/2023, 5:55 AM
    In basic HTML some will not be posted if they are empty or disabled or whatever. Likely not an htmx thing.
  • g

    gray-morning-3453

    03/20/2023, 6:17 AM
    hm. I see.
  • f

    freezing-waitress-26396

    03/20/2023, 10:19 AM
    Empty inputs aren't submitted to POST, the common way to assure that there's always all inputs in the POST is to precede an input with a
    hidden input
    using the same name and a predetermined value. Should the actual input be empty, the hidden's value is taken to POST, otherwise the last element of multiple elements using the same name is passed to POST.
  • r

    rough-horse-47778

    03/20/2023, 1:16 PM
    If I have a template that I swap into the page using htmx, and within the template there is a setTimeout or setInterval, is there a good way to cancel the interval or timer before the element unloads (due to say a user clicking to request a different element to be loaded)??
  • n

    numerous-agent-22346

    03/20/2023, 1:26 PM
    Maybe you want to call clearTimeout(timeout-id) on button.click() You can get a reference for the timeout-id by calling, for instance, console.log(id), inside the timeout handler
  • n

    numerous-agent-22346

    03/20/2023, 3:36 PM
    I've just refactored an old piece of code in which the input checkboxes did not have any value. There was instead a jquery script selecting the attribute name of the checked boxed. 👌
  • b

    bumpy-kangaroo-60192

    03/20/2023, 4:37 PM
    How do we feel about stimulus.hotwired.dev? I sort of have to steal a widget that uses it and it needs to resize and reposition itself. But the widget produces normal dom events which is nice, although always on document. I'll fix that part.
  • b

    bumpy-kangaroo-60192

    03/20/2023, 4:37 PM
    Yet another javascript framework I've never heard of.
  • m

    mysterious-toddler-20573

    03/20/2023, 4:40 PM
    No strong feelings on it, it's a bit heavier than https://hyperscript.org which has advantages and disadvantages depending on what you are trying to do. Makes more sense than hyperscript for component-type stuff. So long as it is triggering events properly it should play well w/ htmx and the rest of the DOM-oriented ecosystem. I know that contexte used it in their Mother of All htmx Demos: https://htmx.org/essays/a-real-world-react-to-htmx-port/ so I regard that as a strong vote of confidence.
  • b

    bumpy-kangaroo-60192

    03/20/2023, 4:41 PM
    Ah cool.
  • b

    bumpy-kangaroo-60192

    03/20/2023, 6:14 PM
    Any way to trigger PUT when checking checkbox and DELETE when unchecking said checkbox?
  • b

    bumpy-kangaroo-60192

    03/20/2023, 6:16 PM
    I am in a place that is not elegant so I will probably turn this into a normal POST form that does both on clicking button.
  • m

    mysterious-toddler-20573

    03/20/2023, 6:29 PM
    doable w/ the
    htmx:configRequest
    event, but yes, this is not a place of honor
  • q

    quaint-controller-17028

    03/20/2023, 10:39 PM
    hello, I am having trouble with datatables
  • q

    quaint-controller-17028

    03/20/2023, 10:46 PM
    I'm using DataTables.net to add search, pagination, and filtering functionality. table rows are pulled from the database using
  • q

    quaint-controller-17028

    03/20/2023, 10:46 PM
  • q

    quaint-controller-17028

    03/20/2023, 10:46 PM
    table not rendered as datatable
  • q

    quaint-controller-17028

    03/20/2023, 10:46 PM
    appreciate all the help
  • m

    mysterious-toddler-20573

    03/21/2023, 1:48 AM
    You probably need to init the datatable in an
    htmx.onLoad()
    block: https://htmx.org/docs/#3rd-party
  • r

    rough-horse-47778

    03/21/2023, 11:16 AM
    I was hoping I could co-locate the code in the template that was swapped in. Something like an attribute of "hx-before-swap" where I could execute the handler to cancel the timeouts. If I do it on the button click, the code ends up in another area where it might be confusing to understand why it's there.
  • n

    numerous-agent-22346

    03/21/2023, 8:08 PM
    If I understand correctly you have a template that you swap into the page. It shouldnt be so hard to reach the html node you want starting from the template. You coud simply add an id to the element you would like to trigger the clear interval. In this way you can reach the element from whenever you want thanks to its id
  • s

    some-airline-73512

    03/21/2023, 8:45 PM
    Would htmx be a good choice for analytics page? Like Google Analytics
  • s

    some-airline-73512

    03/21/2023, 8:46 PM
    Maybe anyone done this before, what libraries did you use?
  • h

    happy-knife-63802

    03/21/2023, 9:05 PM
    is there some way to set a default value for the user input on hx-prompt? cant find a test demonstrating this
  • m

    mysterious-toddler-20573

    03/21/2023, 9:22 PM
    not currently, unfortunately
  • m

    miniature-window-68019

    03/21/2023, 9:22 PM
    I don't see why not, an analytics page is mostly static content anyway
  • s

    some-airline-73512

    03/21/2023, 9:25 PM
    Graphs and diagrams are usually client-rendered I guess. At least I couldn't find a server-rendered graphs yet
  • g

    gorgeous-airport-54386

    03/21/2023, 9:26 PM
    The data for the graphs can be sent in the HTML though.
1...107310741075...1146Latest