Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
If the form fails validation and a cached copy is then served, pathauto_form_alter() is not invoked and the JS doesn't get added (we never reach this line).
Probably need to use something like an #after_build property on the form instead.
Comment | File | Size | Author |
---|---|---|---|
#6 | 578862-pathauto-form-after-build-add-js.patch | 2.91 KB | Dave Reid |
Comments
Comment #1
gregglesYep, I can confirm this. Bummer.
Comment #2
Dave ReidThis is by design with Drupal caching forms in D6. Fixed in D7. :/
Comment #3
gpk CreditAttribution: gpk commentedHave since discovered that adding the JS directly in hook_form_alter() is the wrong way to do it. #after_build and #pre_render both work, and the latter might be preferred in general. Examples: OG, CCK.
Comment #4
gpk CreditAttribution: gpk commentedComment #5
Dave ReidThat may be true, but core doesn't do anything to go around it either, so I don't think it should be something we want to work around with Pathauto. :/
Comment #6
Dave ReidPatch with a test to use #after_build to include the JS.