bigskysoftware / bigskysoftware/htmx

hx-trigger="change" on a form does not react to input changes "outside" the form

Open
#2,937 2 comments 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
49.4k
Forks
1.7k
Avg merge
3d 22h
Merged PRs (30d)
30

Description

In HTML, it's possible to have form components (buttons, inputs, selects, ...) outside of a form by adding the `form=#myFormId` attribute on them.

```html


Submit

a
b

```
Using HTMX (via hx-boost or hx-get/hx-post) the outside select value is used correctly when making the call ✅ (ex: `/currentPage?text=abc&outside=a`)

But I can't find a way to trigger the form when the outside select value change.

```html


Submit


a
b

```

Example of the behavior: https://plnkr.co/edit/sXNvKYobVl6iD5NQ

A stopgap solution is to add a bit of JS on each out-of-form input: `onchange="this.form.requestSubmit()"` and have `hx-trigger="submit change"`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.