Closed (fixed)
Project:
Finder
Version:
7.x-2.x-dev
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
7 Sep 2011 at 15:20 UTC
Updated:
9 Apr 2012 at 09:00 UTC
Jump to comment: Most recent
Hello!
I see the following error when trying to use finder with AJAX turned on.
An AJAX HTTP error occurred.
HTTP Result Code: 200
Debugging information follows.
Path: /system/ajax
StatusText: OK
ResponseText:
Fatal error: Call to undefined function finder_form_validate() in Z:\home\test.ru\www\includes\form.inc on line 1414
Reproduction
1. Install Drupal 7.8 and today's (Sep-07, 2011) finder
2. Activate Finder & Finder Node & Finder text modules
3. Add several content pages (I have added 5)
4. Add a node finder with Text field to search through node titles
5. Mark "Use Ajax on submit button"
6. Go to /finder/1
7. Insert any text and press "Find" button
Here is my finder (just in case)
array(
'finder_id' => '1',
'base' => 'node',
'title' => 'Finder 1',
'description' => '',
'path' => 'finder/1',
'block' => '0',
'settings' => array(
'form_on_page' => 1,
'form' => array(
'prefix' => array(
'value' => '',
'format' => 'filtered_html',
),
'suffix' => array(
'value' => '',
'format' => 'filtered_html',
),
'button_text' => 'Find',
'go_text' => 'Go',
),
'advanced' => array(
'no_results' => array(
'no_results' => 'There are no results to display',
),
'filter' => 0,
'validate_empty' => 0,
'submission' => 1,
'ajax' => 1,
'ajax_effect' => 'none',
'ajax_remote' => 0,
'element_combination' => '0',
'pager' => '10',
'goto' => '',
'hide_args' => 0,
'arg_sep' => ',',
'empty_symbol' => '',
'show_links' => 1,
'show_admin_links' => 1,
'cache_finder_find' => '0',
),
),
'elements' => array(
'0' => array(
'finder_element_id' => '1',
'finder_id' => '1',
'element' => 'text',
'title' => 'Заголовок',
'weight' => '0',
'settings' => array(
'form' => array(
'description' => '',
'prefix' => array(
'value' => '',
'format' => 'filtered_html',
),
'suffix' => array(
'value' => '',
'format' => 'filtered_html',
),
'default_value' => '',
'required' => 0,
'field_prefix' => '',
'field_suffix' => '',
'maxlength' => '',
'minlength' => '',
'size' => '',
'rows' => '0',
),
'choices' => array(
'field' => array(
'node.title' => 'node.title',
),
'node_types' => array(
'' => '',
),
'published' => 1,
),
'advanced' => array(
'delimit' => '',
'field_combination' => '0',
'value_combination' => '0',
'nesting_order' => '0',
'match' => 'c',
),
),
'element_handler' => array(
'#title' => 'Text',
'#module' => 'finder_text',
),
'#_finder_object' => '1',
),
),
'elements_index' => array(
'1' => 0,
),
'base_handler' => array(
'#title' => 'Node finder',
'#module' => 'finder_node',
),
'admin_links' => array(
'finder/1' => 'View \"Path\"',
'admin/structure/finder/1/edit' => 'Edit',
),
'links' => array(),
'#_finder_object' => '1',
)Asking for any help :)
Comments
Comment #1
Georgii commentedComment #2
danielb commentedGood on ya, thanks.
Comment #3
Georgii commented@danielb,
Thanks for looking at this so quickly but unfortunately I fail to test this successfully. I have exactly the same error when I press "Find" button.
* Cache of Drupal and browser was cleared each time I was testing.
Comment #4
danielb commentedMarking as fixed because the date of your post #3 precedes the date on the dev snapshot.
Comment #5
danielb commentedactually i got the error just then
strange
I did use form_load_include(), but I am suspecting this doesn't actually make sense the way it's done :/
Comment #6
danielb commentedI think I'm supposed to use form_load_include() instead of module_load_include() when I include the form in finder_view().
I think.
Comment #7
danielb commentedNo that's not right. I was using it right the first time, but the path was slightly wrong.
Anyway fixing this seems to cause some other issue, so I'm not committing anything yet.
Comment #8
Georgii commented@danielb
Thank you for working on this while keeping community informed :)
I wish I could help but my experience in Drupal programming is too low to dig inside such an advanced module like Finder.
Comment #9
danielb commentedthis is not going well :/
Comment #10
danielb commentedI don't know, I get some bizarre error that doesn't actually look like an error when I try to use ajax. Rewritten it three times and nothing works.
It's committed if you want a look.
Do you get an error like:
Comment #11
Georgii commented@danielb
Sure, I'd like to look at that but it seems that I'm not able to download the latest commit.
I don't have access to Git and the latest 7.x-dev version is dated as Sep-100 for me.
What should I do do get the version with your latest commits?
Comment #12
danielb commentedwait 12 hours :/
(FYI though; everyone has access to git, just follow the 'version control' link on the finder project page.)
Comment #13
Georgii commentedOK, I will wait and come back with results.
(Thanks! It looks like I have to install some SW to execute those commands and get the latest commits instantly. So I wait 12 hrs.)
Comment #14
Georgii commentedI get exactly the same error as you described. Looks like it tries to print out the page content: I see CSS inclusions, links from blocks etc.
Comment #15
danielb commentedyeah that's what I suspect is happening
but if I go to the path: finder_ajax/(finder id)/(finder/path/here)
It seems to print legit JSON output without all that other stuff? Although I never checked the source.
Kind of frustrating because I tried to do pretty much the same thing as I did in Drupal 6, and it just didn't work...
Comment #16
Georgii commentedThat's right. I see
{"status":true,"data":"\u003cdiv class=\"finder-view-1 finder-view\"\u003e\u003cdiv id=\"finder-admin-links-1\"\r\non that pageFor me it looks like some headers here are doing their bad job. I'll take a look
Comment #17
Georgii commentedThis is what I have digging deep into POST query of a finder (using FireBug)
The request headers
There is nothing suspicious to me.
Here is the POST content parsed
Can it help somehow?
Comment #18
danielb commentedIf there is useful info there, then I lack the knowledge to use it, sorry.
The thing about the headers might be a potential lead. I guess I could try forcing them, I think i've seen that done before.
Comment #19
flipolopo commentedI have same ajax errors on all drupal ajax supported modules and it helps me?
http://drupal.org/node/1067750#comment-4941822
Comment #20
rdiazjokyo commentedsubscribe
Comment #21
danielb commentedComment #22
danielb commentedI have tried to do this ajax a hundred different ways, it's not working...
Comment #23
kclarkson commentedAny update on the fix for this error?
I am getting the same AJAX error and I have downloaded the most recent dev. version of this module.
Thanks,
Comment #24
danielb commentedThis continues to be a problem in the new version. :(
I cannot find an example of using FAPI #ajax 'path' in Drupal 7 anywhere.
Comment #25
r13ose commentedHas there been any updates on this as this has been 3 months since the last comment was made. I have looked around and there are pages with information about what you want and you can read them and figure this out. If this is something where you are stuck on please let the community know where and we can help you figure this out.
Comment #26
danielb commentedI am stuck on it. Since I don't understand what's wrong, I can't elaborate. An example of how to use ajax with a custom path would be great.
This issue is somewhat of a release blocker for 7.x-2.x.
Comment #27
beanluc commentedRegarding #ajax['path']
From http://api.drupal.org/api/drupal/developer!topics!forms_api_reference.html/7#ajax_path
danielb: Consider looking for example implementations of the callback property rather than looking forexample implementations of the page property. In fact, that very page shows such an example, under #ajax['callback'].
I haven't seen any suggestion that you might need a custom path, which is probably the *only* reason someone might want to use ['path'] instead of ['callback'].
Hope this helps.
Comment #28
danielb commentedWhen this issue was created, Finder did use #ajax['callback'].
Comment #29
beanluc commentedOkay. I was just responding to the comment about not being able to find an example of #ajax['path'] in D7.
I also was sort of mentioning the matter of a custom path. Are you sure you need it?
Comment #30
danielb commentedNo I am not sure. Whatever works I guess.
Comment #31
danielb commentedThis issue is doing my head in, I have spent countless hours on it. I can easily create a simple module that does an ajax submit, but it doesn't work in finder no matter what I try.
The basic description of the problem is that the 'http response' from system/ajax is the entire HTML for the results page (with results worked out correctly!) including all the template headers/footers - everything, even if the ajax callback is set to return a dummy value, AND EVEN WHEN THE CALLBACK FUNCTION DOES NOT EXIST AT ALL.
Comment #32
danielb commentedok writing that post made me realise it was the submit function causing the problems, it does stuff *sigh*
Comment #33
danielb commentedThe functions finder_form_submit(), finder_form_state(), and possibly finder_form_goto() are not designed well, were initially written before a lot of features were added which have been hacked in, and I avoided changing them too much during the D7 port to avoid surprises. It seems now the current state of the functions is more trouble than it's worth. These functions need to be reconsidered and/or rewritten with the following things in mind:
- The normal way a typical drupal form sends information to create a follow-up page.
- Avoid using a redirect to go to the results page
- Finders with url args
- Finders without url args
- Finders with ajax
- Finders with multiple step forms (future functionality)
I think I will try to base finder forms on ctools_dependant and the ctools form wizard and not rely on the url as a primary method of communicating information between instances of finder pages - it should only be a backup method like when you give your results link to a friend to look at.
Comment #34
Anonymous (not verified) commentedsuscribe.
I have the same error, after a fresh install on drupal 7. I have an AJAX error on every link I click on.
The module cannot be correctly used. ;'-(
Comment #35
danielb commentedYou don't need to reply to a thread to subscribe to it. Saying stuff here at this point can only make things worse.
Comment #36
danielb commentedI've given up on improving the stuff I said in #33 because "typical drupal form sends information to create a follow-up page" is not a concept that exists in drupal at all, which I guess is why I wrote it this convoluted way to begin with.
I've fixed the error and ajax returns stuff correctly, however when using ajax no results are calculated and I can't figure out why.
Comment #37
danielb commentedgetting a little closer, but I gotta go cook some salmon
wish there was an issue queue for that
Comment #38
danielb commentedgot it working now