Active
Project:
Ajax
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Reporter:
Created:
17 Apr 2009 at 08:22 UTC
Updated:
22 Jan 2010 at 05:26 UTC
Jump to comment: Most recent file
I could not make this module working. I installed the D6 dev. version. Enabled the modules Ajax, Ajax plugin comment, Ajax plugin thickbox, Ajax plugin - wysiwyg, Ajax ui. Then enabled all options on Ajax Settings. I tried to create a new Story content. I tried to save the form without the necessary Title information. I was expecting an error message without refreshing the page, but the error was message was shown after a page refresh.
| Comment | File | Size | Author |
|---|---|---|---|
| #14 | drupalexample3.txt | 38.3 KB | mcload |
| #5 | drupalexample2.txt | 46.86 KB | mcload |
| #2 | drupalexample.txt | 45.41 KB | mcload |
Comments
Comment #1
brendoncrawford commentedMcload,
Can you post the html dump of the page containing the form you are trying to submit?
Comment #2
mcload commentedAttaced the html code of Story content creation page as a txt file.
Comment #3
brendoncrawford commentedmcload,
It looks like the ajax.js script is never being loaded into the document. Does your page.tpl.php have something like this:
print $scripts;Comment #4
mcload commentedI am using the garland theme inside Drupal. I checked it now. It has that
print $scriptscommand at page.tpl.php.I am using "Optimize JavaScript files" option under Performance of Drupal. I thought that maybe it is related, but I did not see a change after disabling it.
Comment #5
mcload commentedAttaced the html source code after disabling "Optimize JavaScript files".
Comment #6
brendoncrawford commentedLooking at this...
The Ajax module has not activated this form. Did you enable the story node in "admin/settings/ajax"?
Comment #7
mcload commentedYes, I enabled all options on "admin/settings/ajax" including Story.
Comment #8
brendoncrawford commentedMcLoad,
This is very odd. Perhaps you could provide the following:
1) Drupal version
2) PHP version
3) Operating system name and version
4) Web server name and version
5) Browser name and version
Comment #9
mcload commented1) Drupal 6.10
2) PHP/5.2.5
3) CENTOS 5.2 i686
4) Apache/2.0.63
5) Firefox 3.08, IE 8
Comment #10
brendoncrawford commentedCan you try with only the ajax and ajax_ui module enabled?
Comment #11
Babalu commentedi have the same problem that ajax is not working on my site.
after enabling the module i have the problem that i can't add/create any new node/content type.
it shows me the message "access denied". but i'm the admin :)
with enabled content type at ajax settings and disabled content type at ajax settings
only the comment form is working
Comment #12
Babalu commentedthe problem is still there when i'm now disable and uninstall the module
i can't add/create any new node/content type.
either access denied or submit event, video, group without everything i can do to create a node, just the title submit ...
Comment #13
brendoncrawford commentedBabalu,
Can you open a new bug for that?
Comment #14
mcload commentedI did some debugging to find the problem. I saw that the Story text box returns false with your function ajax_is_enabled($form). I printed the $form array and saw that $form does not have #ajax field. Attached the print_r output of $form as a text file.
Where is the code that inserts #ajax field to form? I can check there.
Comment #15
brendoncrawford commentedMcLoad,
The ajax_ui module is reponsible for assigning the #ajax variable to the $form array. I must say that I am stumped.
Comment #16
mcload commentedOK. I did more debugging and found the reason. Normally it should work like this:
1) First, Ajax_ui module's ajax_ui_form_alter function alters the form and makes it Ajax-enabled by entering #Ajax information.
2)Then, Ajax module's ajax_form_alter function checks the form and adds script information if the form is ajax-enabled (form has #Ajax field)
I saw that in my Drupal installation, the order is opposite. Ajax module's ajax_form_alter function is run before Ajax_ui module's ajax_ui_form_alter function, so ajax_form_alter function can not find the #ajax information. Hook order is wrong.
Comment #17
mcload commentedNow, disabled and uninstalled Ajax_ui module. Then enabled Ajax_ui again. However, it did not solve the problem. Ajax_ui module is still processed after ajax module.
Comment #18
brendoncrawford commentedMcload,
Nice catch! I will fix this right away. Thanks for finding this.
Comment #19
brendoncrawford commentedMcload,
This has been fixed in dev. Please allow up to 12 hours for dev to update. Also, be sure to run update.php after upgrading.
Comment #20
2c commentedI'm experiencing a similar problem with 6.x-1.14 and 6.x-1.x-dev. Hopefully it is related.
The module has no effect when the form is presented and when the form is submitted the process appears non-Ajaxified as if the module is having no effect. However, the page that the form lands on is now stripped of ALL Ajax functionality, including modules not directly dependent on the AJAX.module! e.g. Fivestar, Magic Tabs etc. are rendered without Ajax functionality.
I've created a custom module with a MODULENAME_form_alter function for a form and added in the following:
$form['#ajax']['enabled'] = TRUE;
This affects the 'Submit' text of the forms submit button by changing it to 'Loading...' for a few seconds but then the form submits normally.
Do you have the HTML for a form properly working for this module so that I can try and isolate the problem?
Comment #21
brendoncrawford commentedPhonydream2,
I have just added a fix to dev that may address this. Please wait up to 12 hours for the dev package to update. After installing the latest dev package, please run "/update.php". Let me know if this works. If it does not fix your problem, can you please open a new bug for this.
Thanks,
brendon
Comment #22
2c commentedHi Brendon,
Thanks for this, it fixes my problem and specific use case IF I use the 'disable form redirect' functionality (is this a requirement for AJAX-ifying form submits?).
The problem I described in #20 above still persists if the 'disable form redirect' functionality is not employed. Come to think of it, I can't imagine why 'form redirect' functionality should be enabled in any situation where you want the form to submit via AJAX.
Thanks again, let me know if I can help.
Comment #23
brendoncrawford commentedI will have a look.
Comment #24
merlinofchaos commentedBrendon, your use of ajax_preprocess_page() in ajax.module is somewhat dangerous and makes assumptions that may not be true.
IMO, deleting that function and using this instead is much more foolproof:
For others having this issue, Panels Everywhere will cause this issue because it is taking over the page template and causing the preprocess not to run. There are probably any number of other odd ways that ajax.module's preprocess could fail.