Closed (fixed)
Project:
Drupal core
Version:
4.6.6
Component:
forms system
Priority:
Critical
Category:
Bug report
Assigned:
Reporter:
Created:
17 Feb 2006 at 01:52 UTC
Updated:
18 Apr 2006 at 19:41 UTC
Jump to comment: Most recent file
i just had a look at this flexinode issue and discovered that the formapi requires a drupal_goto after each submited form. (due to this patch) imho this isn't really useful...
i've attached a possible solution by changing the formapi behaviour. this fixes the flexinode issue and also this issue for me.
| Comment | File | Size | Author |
|---|---|---|---|
| #16 | form_goto_fix_4.patch | 4.46 KB | chx |
| #10 | form_goto_fix_3.patch | 4.57 KB | chx |
| #9 | formapi_goto2.patch | 5.56 KB | fago |
| #8 | form_goto_fix_2.patch | 4.56 KB | chx |
| #6 | form_goto_fix_1.patch | 4.66 KB | chx |
Comments
Comment #1
chx commentedWell, yes. I also simplified the goto logic a little bit.
Comment #2
chx commentedWe should be very cautious here, because we need to discern between empty string (home page) and nothing (aka NULL). After this (needed) patch is committed you can simply return nothing and not get a goto.
Comment #3
chx commentedComment #4
chx commentedComment #5
chx commentedComment #6
chx commentedComment #7
chx commentedI marked a few issues a duplicate to point here. While technically this is the duplicate but the patch I started from was here. The others was just talk.
Comment #8
chx commentedComment #9
fagoyour patch didn't work for me.
i just cleaned it up (typo) and fixed it - further i changed the default for #redirect from '' to NULL. so that the above mentioned goto() issues are fixed, but the locale string search stilll doesn't work - probably this is another issue. chx's locale.inc changes are still included in this patch
Comment #10
chx commentedI do not agree with removing the default empty goto. The typo is fixed, sorry.
Comment #11
fagosry, if I got this wrong - but imho setting a goto to the frontpage as default redirect isn't really useful?!
Comment #12
chx commentedIMO it is useful. That's always applicable even after deleting something and you can set REQUEST[destination] or REQUEST[edit][destination] before.
Comment #13
morbus ifffago: whether it's useful or not, it's the default behavior of existing core, and should not be changed. We're trying to minimize changes and "features" to get ready for an RC, so the patches should be as minimalistic and bugfix-only as possible. So +1 to RTC'd #10, and fago, if you really want no default (which, honestly, I do too), you should consider opening a new "normal" "feature request" so that it can be attended to for 4.8.
Comment #14
chx commenteddrumm votes on FALSE instead of NULL, he is right, but I have some problem w/ testing that patch. Stay tuned.
Comment #15
Ariel T Glenn commentedfago noted:
Yes. Having hit the drupal_goto() issue in both variations while I am writing a module, I recognize the locale module issue as this:
With the existing drupal_get_form() you cannot do this, because a call to drupal_get_form() to generate the new form will check $_POST['edit'] and see that stuff is in there. It will then go through the validate/submit/drupal_goto branch instead of the form generation code you want.
This is distinct from the user module issue described here by everyone else, and so the locale module bug really shouldn't be marked as a dup of this one.
To fix this bug, I suggest that the caller needs to be able to tell drupal_get_form() that it should really really not go through the validation/submit branch even if there is stuff in $_POST; say, an extra parameter to drupal_get_form(). If the extra arg is not passed, the default behavior should apply.
In addition, for the current patch, the submit/validate branch should return (an empty value, maybe) rather than falling through to the form generation code if there is no goto. Then form generation will not be required in order to do other things after validation/submit than a redirect.
Someone in the comments on issue 49123 tried setting $_POST['edit'] to NULL before _locale_string_seek_form(); and got the correct output, which shows that avoiding the validation/submit branch altogether is the appropriate behavior for these sorts of forms generated from results of other forms.
Unless folks think of a better way to handle this...
Comment #16
chx commentedWe are good to go. If you do not want to redirect you set #redirect to FALSE.
For the above, slightly off topic lengthy comment, use a button not a submit and you'll be good.
Comment #17
chx commentedIf you do not want to redirect you set #redirect to FALSE or return FALSE in submit.
Comment #18
dries commentedCommitted to HEAD. Thanks.
(Beh, more form attributes.)
Comment #19
(not verified) commentedComment #20
ultraBoy commentedPlease! mention this "['#redirect'] = FALSE" possibility, 'cause I spent about 10Hrs to identify my problem with redirection and then to find a solution.