I am trying to use ctools modal form to edit node form. This form is containing a file field. The Form is rendering properly. When I try to upload a file on clicking upload button, file field has been deleted from the page. I tried to debug via firebug to see the response, it was correct as we get without modal form.

I added the following code in modal callback.

ctools_include('node.pages', 'node', '');

$form_state['build_info']['args'] = isset($form_state['build_info']['args']) ? $form_state['build_info']['args'] : array($node);
form_load_include($form_state, 'inc', 'node', 'node.pages');

I took the reference from Ajax upload in Ctools Modal Window but it still having problem.

1 Answer 1


Make sure you're implementing the right Drupal API syntax which requires $form_state to be the reference to the original array, so it can be properly modified through certain hooks.

For example if you're using form_load_include() in hook_form_alter(), make sure you're following the right API syntax which is:

hook_form_alter(&$form, &$form_state, $form_id)

(note the &) otherwise form_load_include() can't perform alterations of your current state of the form ($form_state).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.