Django and HTMX #14 - Trigger Filters for Conditionally Triggering Requests

In this video, we’ll look into Trigger Filters in HTMX. These are defined with a JavaScript expression in square-brackets after the normal event name used in the hx-trigger attribute, and they allow you to conditionally trigger the request based on conditions. In this video, we’ll demonstrate triggering the username check request ONLY if the username that has been entered into the input element is greater than 3 characters length. 📌 𝗖𝗵𝗮𝗽𝘁𝗲𝗿𝘀: 00:00 Intro 02:59 Using HTMX trigger filter 04:17 Trigger filter for checking username length 06:12 Using global JavaScript function as trigger filter ☕️ 𝗕𝘂𝘆 𝗺𝗲 𝗮 𝗰𝗼𝗳𝗳𝗲𝗲: To support the channel and encourage new videos, please consider buying me a coffee here: 𝗦𝗼𝗰𝗶𝗮𝗹 𝗠𝗲𝗱𝗶𝗮: 📖 Blog: 👾 Github: 🐦 Twitter: 📚 𝗙𝘂𝗿𝘁𝗵𝗲𝗿 𝗿𝗲𝗮𝗱𝗶𝗻𝗴 𝗮𝗻𝗱 𝗶𝗻𝗳𝗼𝗿𝗺𝗮𝘁𝗶𝗼𝗻: Trigger Filters: #trigger-filters #django #htmx #python
Back to Top