bigskysoftware / htmx

</> htmx - high power tools for HTML
https://htmx.org
Other
36.9k stars 1.25k forks source link

Upgraded from 1.9.5 to 2.0.0-alpha1, input hx-trigger not working if input is inside a form #2251

Open szattila98 opened 7 months ago

szattila98 commented 7 months ago

Hello, I am having an issue after upgrading from 1.9.5 to 2.0.0-alpha1. I have a search bar, which can do active search, if the user types into the input and also the input is inside a boosted form, which, if submitted, shows the search page. The first functionality is basically the active search example from the htmx page, and the second part is just a boosted form. It worked as expected at 1.9.5, but after upgrading, the active search part does not trigger anymore on input, sending no requests. Is this expected and I should work around it somehow, or is this a bug? I copy the actual code down below, thank you in advance.

<div class="searchContainer">
    <form action="/search" class="searchbar" hx-boost="true">
        <input name="query" type="search" placeholder="What film are you looking for?" class="search" required minlength="1" maxlength="{{ crate::search::MAX_QUERY_LEN }}"
            hx-get="/search/autosuggest" hx-trigger="input changed delay:200ms, search" hx-target="#autosuggest-results" hx-swap="outerHTML" hx-validate="true"
        />
        <button type="submit" class="search-button">
            <svg width="20" height="20" viewBox="0 0 24 24">
                <use href="/assets/img/main.svg#search-logo" />
            </svg>
        </button>
    </form>
    <ul id="autosuggest-results" class="autosuggest-results" hx-boost="true"></ul> 
</div>
Telroshan commented 6 months ago

Hey, sorry for the late reply! Does it still happen with the latest state of the v2.0v2.0 branch ?

1cg commented 3 months ago

@szattila98 can you reverify with the latest 2.0 from https://raw.githubusercontent.com/bigskysoftware/htmx/dev/src/htmx.js