Home

Stefano Mallozzi Professional web developmentStefano Mallozzi Professional web development

Condividi contenuti
  • About me
  • Bookmark
  • Tips and tricks
  • Tutorials
  • Contact me
  • Feed aggregator
Home

Languages

  • Italiano
  • English

Contact me

Links

Tag cloud

connection drupal i18n ics images internet lan network node images photo php seo
More tags

Photo galleries

  • Pictures of Gaeta

Fix missing loading of Javascript and CSS in hook_form_alter() when node form is not validated

Sun, 20/03/2011 - 02:02 — stefano

If you call functions drupal_add_js() or drupal_add_css() in a hook_form_alter() of a custom module, it may happen that if the form is not validated it won't load Javascrpt and CSS.
You can fix this problem by adding the #after_build to your form, and then moving drupal_add_js() and drupal_add_css() in the associated function. This way the hook_form_alter() will contains form elements only, and the #after_build will load Javascript and CSS.

Tags:
  • Drupal
  • drupal
  • form
  • validation
»
  • Italiano

© Stefano Mallozzi
P.IVA 02155580596
Valid XHTML 1.0 Strict Valid CSS Valid RSS
Powered by Drupal Powered by Apache Powered by MySQL Powered by PHP