htmx icon indicating copy to clipboard operation
htmx copied to clipboard

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

Open szattila98 opened this issue 1 year ago • 2 comments

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>

szattila98 avatar Jan 27 '24 21:01 szattila98

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

Telroshan avatar Feb 25 '24 20:02 Telroshan

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

1cg avatar May 15 '24 17:05 1cg