If the node form is reloaded due to an error (e.g. missing title), the modal node reference popup no longer works. If you click the link to create a new referenced node, the form loads in a new page.
It appears that modal_noderef.js is not loaded in this scenario.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | no_js_after_error-1132226-1.patch | 1.56 KB | paulmckibben |
Comments
Comment #1
paulmckibbenThe problem is that you cannot rely on hook_form_alter to add javascript, because if the form is cached, and it fails validation, the javascript will not be re-added if the form is reload.
The attached patch uses an #after_build function to add modal_noderef.js. The #after_build function is called even when the form is reloaded after failing validation.
Please review and let me know if I need to change anything. I look forward to this being incorporated into the module.