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

    stocky-mechanic-87541

    06/30/2022, 1:27 PM
    Hi, my framework's API expects list query parameters to be supplied as follows:
    ?argument=one&argument=two
    etc. How would I send such GET parameters (without hard-coding of course) with HTMX?
  • m

    mysterious-toddler-20573

    06/30/2022, 1:34 PM
    where are these parameters sourced from?
  • m

    mysterious-toddler-20573

    06/30/2022, 1:35 PM
    If they are hidden inputs, use
    hx-include
    to include them
  • s

    stocky-mechanic-87541

    06/30/2022, 1:46 PM
    Hidden input would be fine, but they are a dynamic amount. So e.g. zero up to any amount of 'tags'.
  • m

    mysterious-toddler-20573

    06/30/2022, 1:47 PM
    you can put the same class on each of them and include via a
    .class
    reference in hx-include
  • s

    stocky-mechanic-87541

    06/30/2022, 1:48 PM
    So I could create an input for each of them with the same name using e.g. _hyperscript and then hx-include them by class?
  • m

    mysterious-toddler-20573

    06/30/2022, 1:48 PM
    I would emit them server side, all with the same class on them and include them via that class
  • m

    mysterious-toddler-20573

    06/30/2022, 1:48 PM
    just one class, same on all the inputs
  • s

    stocky-mechanic-87541

    06/30/2022, 1:49 PM
    I can't do that server-side since the user selects it from a different part of the UI
  • s

    stocky-mechanic-87541

    06/30/2022, 1:50 PM
    But I could add/remove the class on the hidden input based on whether it should be hx-included
  • s

    stocky-mechanic-87541

    06/30/2022, 1:50 PM
    I'll try something, thanks for the help!
  • t

    tall-dinner-62086

    06/30/2022, 1:52 PM
    hx-include=".class[selected]"
  • m

    mysterious-toddler-20573

    06/30/2022, 2:12 PM
    depending on how exactly they select those things (check boxes?) then you could include the same class on all those element and include it:
    Copy code
    html
    <button hx-include=".boxes" hx-post="/whatever"> ... </button>
    
    <input type="checkbox" name="foo" class="boxes"/> 
    
    ...
    
    <input type="checkbox" name="foo" class="boxes"/> 
    
    ...
    
    <input type="checkbox" name="foo" class="boxes"/>
  • m

    mysterious-toddler-20573

    06/30/2022, 2:12 PM
    hx-include will include everything matching the selector no matter where it is in the page
  • m

    most-jelly-15242

    06/30/2022, 4:22 PM
    Hey @powerful-army-90860 Did you get this working? I developed the extension and just verified that a simple form with a submit button getting disabled works for me. Your code looks correct. I tried to create a code pen but the same example doesn't work there. Not sure if the demo script supports using extensions? @mysterious-toddler-20573
  • m

    mysterious-toddler-20573

    06/30/2022, 5:05 PM
    extensions are going to be problematic using the demo script due to lazy loading 😑
  • m

    mysterious-toddler-20573

    06/30/2022, 8:15 PM
    https://twitter.com/GrugBrainedDev/status/1542598342986719232
  • h

    hundreds-camera-24900

    06/30/2022, 8:42 PM

    https://www.youtube.com/watch?v=VvPaEsuz-tYâ–¾

  • p

    powerful-eye-47205

    06/30/2022, 10:54 PM
    I'm trying to figure out why the default swap method is innerHTML but OOB swaps default to outerHTML which seems more natural to me. For now, I'm just using to "fix" this inconsistency. But I wonder if there's some good reason for the default setting that I might be missing?
  • a

    ancient-father-3063

    06/30/2022, 11:13 PM
    Can I have htmx do two different things (from one trigger?) I want to do like hx-get /urlA hx-target A and hx-get /urlB hx-target B
  • m

    mysterious-toddler-20573

    06/30/2022, 11:21 PM
    depending on what tools you have available, you could either use out of band swaps for this and do it in one request, or use the
    from:
    clause in hx-trigger, and have an element listen to the triggering UI and fire that second /urlB request
  • l

    late-king-98305

    06/30/2022, 11:34 PM
    You know that cool trick where you can return
    false
    from an
    a
    tag's
    onclick
    handler, and it cancels navigation? Not if it's boosted. :/ (Remember this, my friends; help these hours I spent be not in vain...)
  • m

    mysterious-toddler-20573

    07/01/2022, 12:05 AM
    😑
  • m

    mysterious-toddler-20573

    07/01/2022, 12:05 AM
    man
  • m

    mysterious-toddler-20573

    07/01/2022, 12:05 AM
    Daniel is finding all the bad stuff
  • l

    late-king-98305

    07/01/2022, 12:20 AM
    Sorry... (I would bet that the
    false
    thing is difficult; I would think a doc caveat would be way easier! LOL)
  • l

    late-king-98305

    07/01/2022, 12:20 AM
    Should I file an issue for that? (either one)
  • m

    mysterious-toddler-20573

    07/01/2022, 12:21 AM
    yes, please file an issue for that as well as the anchor issue you noted the other day
  • m

    mysterious-toddler-20573

    07/01/2022, 12:21 AM
    wont' make 1.8, but I'll try to get fixes in for 1.8.1
  • l

    late-king-98305

    07/01/2022, 12:38 AM
    953 and 954 have been submitted. I linked one example, and made a short one for the other; trying to walk the line between expert mode and novice mode. Hopefully I got it right. 🙂
1...731732733...1146Latest