This is because on form error the form comes out of the cache table and
skips fetching the form and all its _alter's. The 'best' practice I have
found is to use a #pre_render function to drupal_add_js(). pre_render's are
called always.
<?php
function my_form_alter() {
  // add my elements
  $form['#pre_render'][] = 'my_load_js';
}
?>

<?php
function my_load_js($form) {
  drupal_add_js();
  return $form;
}
?>

-- 
Scott Reynolds

Reply via email to