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.

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
StatusFileSize
new2.91 KB

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

mably’s picture

Issue summary: View changes
Status: Needs review » Closed (outdated)

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.