Trying to upload a file using the upload button in a local action to create a node fails with the following error:

* Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'node_form' not found or invalid function name in drupal_retrieve_form() (line 771 of /home/quickstart/websites/namakadance.dev/includes/form.inc).
* Notice: Undefined index: #node in comment_form_node_form_alter() (line 1190 of /home/quickstart/websites/namakadance.dev/modules/comment/comment.module).
* Notice: Trying to get property of non-object in comment_form_node_form_alter() (line 1207 of /home/quickstart/websites/namakadance.dev/modules/comment/comment.module).
* Notice: Undefined index: #node in menu_form_node_form_alter() (line 594 of /home/quickstart/websites/namakadance.dev/modules/menu/menu.module).
* Notice: Trying to get property of non-object in menu_form_node_form_alter() (line 594 of /home/quickstart/websites/namakadance.dev/modules/menu/menu.module).
* Notice: Undefined index: #node in menu_form_node_form_alter() (line 600 of /home/quickstart/websites/namakadance.dev/modules/menu/menu.module).
* Notice: Trying to get property of non-object in menu_form_node_form_alter() (line 600 of /home/quickstart/websites/namakadance.dev/modules/menu/menu.module).
* Notice: Undefined index: field_mp3_file in file_ajax_upload() (line 265 of /home/quickstart/websites/namakadance.dev/modules/file/file.module).
* Notice: Undefined index: #suffix in file_ajax_upload() (line 274 of /home/quickstart/websites/namakadance.dev/modules/file/file.module).

Steps to reproduce:
Create a new Drupal 7 Web site.
Download views, ctools and context_admin
Enable ctools, page_manager, views, views_ui and context_admin
Create a new content type.
Add a File Field
Test that adding adding a node and using the upload button works.
Add Content
Choose the content type you created
Browse for a file and click upload. (this works)

Create a new page view of the content type you created.
Create a new page with a local action to create the node you just created.
Structure/Pages/Add custom page
Set up the page as a local action to create node.

When using this new action the file upload button will fail with the above message.

I am pretty new to PHP and Drupal so I was not able to figure out how to patch this to make it work, but seems to be a pretty big bug. Hope someone knows better than me how to fix it.

BTW I found that ctools had a similar bug. https://drupal.org/node/1105624
It appears they have fixed that bug, but it did not give me any clues on how to fix it in Context admin. For now I will not be able to use the Create Node functionality if the content type has a file upload field.

I hope I provided enough information because I really like this module.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

EclipseGc’s picture

Assigned: Unassigned » EclipseGc

Your docs look pretty good, I'll see if I can replicate this shortly. Definitely want to fix that.

markduce’s picture

Did you get anywhere with this?

I'd be interested to hear the outcome.

markduce’s picture

Status: Active » Closed (fixed)

If you upgrade to the latest version of Ctools this problem is fixed

g76’s picture

still happening with latest Ctools 7.x-1.x-dev (2011-Jul-28), fresh install

just wanted to say I am so excited about ca, as a solo site builder, life will be so much easier. thank you for taking the time to create this and open things up to non-coders, it is very much appreciated.

edit:
error message
Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'node_form' was given in drupal_retrieve_form() (line 772 of /data/all/011/drupal-7.4-dev/includes/form.inc).

g76’s picture

Version: 7.x-1.0-rc2 » 7.x-1.x-dev
Status: Closed (fixed) » Active

hope this is okay, changing to active and against the dev version.

dboulet’s picture

Yup, same problem here with ctools rc1.

EclipseGc’s picture

Priority: Critical » Major

OK, sorry to see this isn't resolved. Been a bit swamped with work, but I'm deploying a site this will matter for personally here semi-soon, so I will be working on this. This probably has something to do with ajax callbacks and the fact that my plugin is manually loading the node_form. I have some ideas at least, thanks for all the docs on this.

g76’s picture

thanks! know the feeling with being swamped:). I am not a coder, but if you need things tested I would be more than happy to do that. again, thank you for all the hard work and the vision.

mh86’s picture

Subscribing.
Experiencing the same problem.

jpfeifer’s picture

subscribe

EclipseGc’s picture

Status: Active » Fixed
FileSize
2.52 KB

OK, so I'm not happy that I had to do it this way, but I made the most of it. I think this will open up some doors in the future. Should be in newest dev, this is what the patch looks like:

EclipseGc’s picture

Added a few more fixes, pretty happy with it at this point.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

alexdezark’s picture

Version: 7.x-1.x-dev » 7.x-1.1
Status: Closed (fixed) » Active

Hi,
I'm using context_admin 7.x-1.1 with Drupal 7.8
I still have the same problem when I'm trying to upload a file in a Context admin.

If a node is created without nothing in the file input and then I try to update the node and upload a file I have the same error message.

Warning : call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'node_form' was given dans drupal_retrieve_form() (ligne 773 dans D:\sites_acquia\test01\includes\form.inc).
Notice : Undefined index: #node dans comment_form_node_form_alter() (ligne 1190 dans D:\sites_acquia\test01\modules\comment\comment.module).
Notice : Trying to get property of non-object dans comment_form_node_form_alter() (ligne 1207 dans D:\sites_acquia\test01\modules\comment\comment.module).
Notice : Undefined index: #node dans menu_form_node_form_alter() (ligne 605 dans D:\sites_acquia\test01\modules\menu\menu.module).
Notice : Trying to get property of non-object dans menu_form_node_form_alter() (ligne 605 dans D:\sites_acquia\test01\modules\menu\menu.module).
Notice : Undefined index: #node dans menu_form_node_form_alter() (ligne 611 dans D:\sites_acquia\test01\modules\menu\menu.module).
Notice : Trying to get property of non-object dans menu_form_node_form_alter() (ligne 611 dans D:\sites_acquia\test01\modules\menu\menu.module).
Notice : Undefined index: #node dans translation_form_node_form_alter() (ligne 126 dans D:\sites_acquia\test01\modules\translation\translation.module).
Notice : Trying to get property of non-object dans translation_form_node_form_alter() (ligne 126 dans D:\sites_acquia\test01\modules\translation\translation.module).
Notice : Undefined index: #node dans i18n_menu_form_node_form_alter() (ligne 651 dans D:\sites_acquia\test01\sites\all\modules\i18n\i18n_menu\i18n_menu.module).
Notice : Undefined index: #node dans i18n_menu_form_node_form_alter() (ligne 652 dans D:\sites_acquia\test01\sites\all\modules\i18n\i18n_menu\i18n_menu.module).
Notice : Trying to get property of non-object dans i18n_menu_form_node_form_alter() (ligne 652 dans D:\sites_acquia\test01\sites\all\modules\i18n\i18n_menu\i18n_menu.module).
Notice : Trying to get property of non-object dans i18n_menu_form_node_form_alter() (ligne 658 dans D:\sites_acquia\test01\sites\all\modules\i18n\i18n_menu\i18n_menu.module).
Notice : Undefined index: #node dans _i18n_node_form_node_form_alter() (ligne 456 dans D:\sites_acquia\test01\sites\all\modules\i18n\i18n_node\i18n_node.module).
Notice : Undefined index: #node dans _i18n_node_form_node_form_alter() (ligne 468 dans D:\sites_acquia\test01\sites\all\modules\i18n\i18n_node\i18n_node.module).
Notice : Trying to get property of non-object dans _i18n_node_form_node_form_alter() (ligne 468 dans D:\sites_acquia\test01\sites\all\modules\i18n\i18n_node\i18n_node.module).
Notice : Undefined index: field_pdf_journal dans file_ajax_upload() (ligne 265 dans D:\sites_acquia\test01\modules\file\file.module).
Notice : Undefined index: #suffix dans file_ajax_upload() (ligne 274 dans D:\sites_acquia\test01\modules\file\file.module).

There's no problem if I upload the file when I create the node, but I can't upload a file in an update operation.
the file is uploaded to the directory, some rows are created in the database but the error apears and the file (it's link) doesn't apears anywhere.

do I have to patch this version of context_admin ?

EclipseGc’s picture

I think this is probably a different issue. Are you using context_admin to display node edits?

alexdezark’s picture

FileSize
2.01 MB

Hi and thanks a lot for your answer,

Yes I'm using context_admin to display node edits.

I've just made a short swf video demo (attachement) to show you the process :

How the link to node edit is generated, a short overview of the page manager and how the bug (??) apears.

EclipseGc’s picture

Yeah I haven't watched your demo yet (don't know if I will cause I'm pretty sure I know the problem here).

I will have to see if the node edit can do this, I'm positive I didn't test it, so I think you've just found a whole in my manual testing. I will try to look at this soonish.

alexdezark’s picture

Well, at last I wrote my own module.
I just needed to hide some fields for the final user, so I did it with some jQuery.

mh86’s picture

Status: Active » Needs review
FileSize
2.38 KB

Attached a patch that fixes the node edit form as well (the same way as it was fixed in #11)

zambrey’s picture

Patch #19 fixed issue with file upload, thanks.

ron_s’s picture

Version: 7.x-1.1 » 7.x-1.x-dev

This same problem exists when trying to create a taxonomy term that includes a Ajax-based file upload.

Requires a different solution though, since the approach to creating the term form in context_admin is different.