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

    happy-knife-63802

    08/22/2022, 11:33 AM
    follow up - i added this in and tested it out in combination with hs as part of the input:
    Copy code
    <input type="text" inputmode="numeric" required pattern="[0-9]*" name="blah" _="on htmx:validation:failed call me.reportValidity()" hx-validate="true">
    and it works wonderfully. thanks!
  • m

    mysterious-toddler-20573

    08/22/2022, 1:09 PM
    🤔 we shoudl probably do that by defult
  • h

    happy-knife-63802

    08/22/2022, 1:25 PM
    the reportValidity part?
  • h

    happy-knife-63802

    08/22/2022, 1:27 PM
    on a side note, i tried chaining some if/else to setCustomValidity on the input depending on its .validity.valueMissing and then .validity.patternMismatch but hs doesnt recognise elif when chaining and i cant get it to work with multiple if else statements to end with setCustomValidity('') as the last branch
  • m

    mysterious-toddler-20573

    08/22/2022, 2:41 PM
    it should be
    else if
    in hyperscript
  • a

    acceptable-spring-94420

    08/22/2022, 2:41 PM
    Hi, my backend serves content from a different subdomain, so I'd like to define a based URL once and have all htmx `hx-get`'s etc use relative URLs e..g.
    Copy code
    <script>
      
        var COCKPITAPIURL = "https://cp2.abcdef.com/cockpit-core/api/"
        var COCKPITTOKEN = "API-5d68fdce4XXXXXXXXXXXXXXX765dde7b03ce13e3"
      </script>
  • a

    acceptable-spring-94420

    08/22/2022, 2:41 PM
    and
  • a

    acceptable-spring-94420

    08/22/2022, 2:42 PM
    <section class="page-section clearfix" hx-get="SOMETHING IN HERE/path/to/endpoint"></section>
  • m

    mysterious-toddler-20573

    08/22/2022, 2:43 PM
    You probably want to catch the
    htmx:configRequest
    event and update the
    event.detail.path
    property
  • a

    acceptable-spring-94420

    08/22/2022, 2:44 PM
    Yep I was wondering that. thanks
  • m

    mysterious-toddler-20573

    08/22/2022, 2:46 PM
    can you include the morphdom extension as well?
  • m

    mysterious-toddler-20573

    08/22/2022, 2:46 PM
    https://github.com/bigskysoftware/htmx/blob/master/src/ext/morphdom-swap.js
  • l

    loud-action-20310

    08/22/2022, 6:16 PM
    anybody knows of a way to init Alpine added in the htmx swap without affecting exsisting ones on the page? Alpine.start() on htmx:afterOnLoad messes up existing "components" that are not part of replacement
  • m

    mysterious-toddler-20573

    08/22/2022, 6:21 PM
    can you target only the new content?
  • m

    mysterious-toddler-20573

    08/22/2022, 6:22 PM
    Copy code
    js
    htmx.onLoad(function(content) {
      // init only stuff in content
    })
  • l

    loud-action-20310

    08/22/2022, 7:11 PM
    and while on this. is there a way to init HS in turbolinks render event ?
  • l

    loud-action-20310

    08/22/2022, 7:11 PM
    similar to
    Copy code
    document.addEventListener('turbolinks:render', () => {
        htmx.process(document.body)
      })
  • l

    loud-action-20310

    08/22/2022, 7:11 PM
    but for hyperscript
  • m

    mysterious-toddler-20573

    08/22/2022, 7:11 PM
    _hyperscript.processNode()
  • m

    mysterious-toddler-20573

    08/22/2022, 7:11 PM
    iirc
  • l

    loud-action-20310

    08/22/2022, 7:15 PM
    cool thx 👍
  • l

    loud-action-20310

    08/22/2022, 7:15 PM
    until I can throw turbolinks out of the window
  • m

    mysterious-toddler-20573

    08/22/2022, 7:21 PM
    i like the energy!
  • l

    loud-action-20310

    08/22/2022, 7:22 PM
    me too not sure about team members yet lol
  • l

    loud-action-20310

    08/22/2022, 7:23 PM
    you can spend days just making various tools working together via events and what not. instead of building things.. it's crazy
  • m

    most-activity-91725

    08/22/2022, 7:47 PM
    I think Alpine is looking for new components all the time via Mutation events, so you shouldn't need to do anything after a "cold start"
  • l

    loud-action-20310

    08/22/2022, 9:24 PM
    indeed 👍
  • e

    early-camera-41285

    08/22/2022, 9:51 PM
    I don't know why this would be possible (but I wouldn't have assumed support for CSS transitions on swap, either, so), is there a way to preserve the state of CSS animations? CSS animations restart if they are in an element that is updated via htmx polling.
  • i

    incalculable-scientist-18707

    08/22/2022, 11:35 PM
    can't get the oob to work here. This gives me an unformatted table row. When I remove the oob it works. Thoughts? {%include 'list.html' %} {% include "detail.html" %}
  • m

    mysterious-toddler-20573

    08/22/2022, 11:59 PM
    table rows are a huge pain to get right.
1...791792793...1146Latest