fix: trigger species search on button click, not on input change
Avoids burning Perenual API quota on every keystroke. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
4b1212c5ec
commit
34f6c3652e
1 changed files with 17 additions and 11 deletions
|
|
@ -4,17 +4,23 @@
|
|||
<h5 class="mb-3">Add a plant</h5>
|
||||
<p class="text-muted small">Search for the species to auto-fill care info, or skip to enter details manually.</p>
|
||||
|
||||
<input
|
||||
type="search"
|
||||
class="form-control mb-2"
|
||||
placeholder="🔍 Search species, e.g. 'climbing rose'"
|
||||
hx-get="{% url 'species_search' %}"
|
||||
hx-trigger="input changed delay:400ms"
|
||||
hx-target="#species-results"
|
||||
hx-swap="innerHTML"
|
||||
name="q"
|
||||
autocomplete="off"
|
||||
>
|
||||
<div class="input-group mb-2">
|
||||
<input
|
||||
type="search"
|
||||
class="form-control"
|
||||
placeholder="e.g. 'climbing rose'"
|
||||
name="q"
|
||||
id="species-q"
|
||||
autocomplete="off"
|
||||
>
|
||||
<button
|
||||
class="btn btn-success"
|
||||
hx-get="{% url 'species_search' %}"
|
||||
hx-include="#species-q"
|
||||
hx-target="#species-results"
|
||||
hx-swap="innerHTML"
|
||||
>Search</button>
|
||||
</div>
|
||||
|
||||
<div id="species-results" class="list-group mb-3"></div>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue