I have created a custom module that changes the layout & adds extra functionality to one of my content type creation and edit forms.
It works beautifully and as expected apart from when I submit the form with, for example, a blank node title or any other required fields.
The page is reloaded as expected with the error message, the form modifications are loaded from the module (field #prefix, #suffix etc..) but the css and the js are not loaded.
Here is the code I have:
/**
* Implementation of HOOK_form_alter()
*/
function mymodule_entry_form_modify_form_alter(&$form, $form_state, $form_id) {
// 1.ENTRY FORM
if ($form_id == 'entry_node_form') {
// here were some form field modifications i removed
/* 1.3 LAYOUT - ADD JAVASCRIPT FILES
* Add .js files
*/
// add jquery script before calling it
drupal_add_js(drupal_get_path('module', 'mymodule') . '/includes/js/jquery.fixheight.js');
// call the script
drupal_add_js(drupal_get_path('module', 'mymodule') . '/includes/js/mymodule_entry_form_modify.js');
/* 1.4 LAYOUT - ADD CSS FILES
* Add .css files
*/
drupal_add_css(drupal_get_path('module', 'mymodule') . '/includes/css/mymodule_entry_form_modify.css');
}
}
Can anyone explain why this happens?