Problem/Motivation
Document how to implement AlertCommand using htmx.
Remaining tasks
Document at https://www.drupal.org/docs/develop/drupal-apis/htmx/ajax-api-to-htmx/alertcommand
Document how to implement AlertCommand using htmx.
Document at https://www.drupal.org/docs/develop/drupal-apis/htmx/ajax-api-to-htmx/alertcommand
Comments
Comment #2
fathershawnComment #3
quietone commentedComment #4
fathershawnComment #5
markie commentedThis command generates a native alert box with the resulting text. Mostly in core this is used in tests. But here's a stab at the documentation.
## AJAX API
Used in tests such as web/core/modules/system/tests/modules/ajax_forms_test/src/Callbacks.php
## HTMX
There is no native alert command in htmx, but you can use the on::afterrequest to trigger a command
### HTMX commands
Comment #6
markie commentedI updated my sample after reading more into the on().
Comment #7
fathershawnThis command is not used in core but I see it is used in contrib.
We should consider a couple of improvements here: