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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

greggles’s picture

Yep, I can confirm this. Bummer.

Dave Reid’s picture

Status: Active » Closed (works as designed)

This is by design with Drupal caching forms in D6. Fixed in D7. :/

gpk’s picture

Status: Active » Closed (works as designed)

Have 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.

gpk’s picture

Status: Closed (works as designed) » Active
Dave Reid’s picture

Version: 7.x-1.x-dev » 6.x-1.x-dev
Status: Closed (works as designed) » Active

That 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. :/

Dave Reid’s picture

Version: 6.x-1.x-dev » 6.x-2.x-dev
Status: Active » Needs review
FileSize
2.91 KB

Patch with a test to use #after_build to include the JS.