bigskysoftware / bigskysoftware/htmx

Only enable swap for hx-target-error

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

Description

I want a form like this:
```


Submit

```

On submit, `path-deps` catches the patch to `/endpoint` and refreshes the related content. So a successful submission should use `hx-swap="none"`. However, that prevents `hx-target-error` from making the error swap so the user can correct the validation mistake.

So I have to do manually hide the response like this or with templating:
```



Submit

```

I cannot find a way to only enable swap for `hx-target-error`. It would be helpful if there was a way to only enable swap for error responses - or something that achieves the same effect.

Thanks!

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.