Needs review
Project:
Ajax
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
18 Feb 2010 at 11:40 UTC
Updated:
1 Aug 2012 at 16:10 UTC
Jump to comment: Most recent file
I have form which i call like this:
module_load_include('inc', 'node', 'node.pages');
$new_blognode = new stdClass();
$new_blognode->type = 'projekti_resurssit';
node_object_prepare($new_blognode);
$output = drupal_get_form('projekti_resurssit_node_form', $new_blognode);
return $output;
The code is in node which is shown by views as an attachment to another view. I have also tried to put the code to footer of view(removing the need for attachment), but same thing.
Now, when user submits the node, it usually gets created two or even three times(sometimes only once)!
If i check the "remove form after submit" thing, it works correctly, but sadly it is not an option for me.
Any clue what's happening? This is really bad thing for me right now, and i'm completely lost!
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | ajax-redirect-causes-forms-to-post-multiple-times-718070-5.patch | 1.49 KB | bfr |
Comments
Comment #1
kvvnn commentedA form of mine is submitting twice.
I am using
within a form in my module that saves some DOM values into the database. I have not investigated whether this is the cause of 'disable redirect' , as I think I need to create a plugin to do so (and haven't had time to do that).
Will be testing and updating, though, :)
Comment #2
drupalina commentedSubscribing.
I have the same problem. I have an auto-refreshing View of "question" content types, and a Form Block on top of that View so that people can submit questions. The idea is to create a Twitter/Facebook style form and view ... so that people submit a question and their question immediately appears below the form. Instead, what I get is that 3, 4, or sometimes even 5 versions of that same question appear. Making the form disappear after posting (in Ajax settings) does not resolve this problem. This bug is pretty critical.
Comment #3
brooksbrown commentedI also was having this problem in the exact same scenario. I assume that the any extra clicks occurring between the submit hook call and the redirect hook call are actually being submitted so I just disabled the submitter during the interval between the calls. This wasnt tested thoroughly but seems to work.
Here is my fix:
add this hook block to ajax_disable_redirect.js
then inside the redirect block
add the line
after
complete function with changes:
Comment #4
brendoncrawford commenteddavibrosk, if you submit a patch for this, I will apply it.
Comment #5
bfr commentedThanks. I created a patch. It's created with with git format-patch, like they now should, so please commit it with this exact command:
git am < ajax-redirect-causes-forms-to-post-multiple-times-718070-5.patchAs i side note, you have files in the master branch. Master branch is deprecated and should be empty.
Comment #6
cluke009 commentedI've pushed this patch up to my github branch. I am going to do some testing on this and try to get through a couple more issues and I will do a pull request.
Comment #7
bfr commentedOut of curiosity, why do have alternative branches in github? Why not use d.org repos?
Comment #8
cluke009 commentedThat is the way brendoncrawford recommended people contribute. Its right at the top of the project page.