The dbtng_example_form_update_submit() function passes the form_state as a normal variable instead of by reference.
This breaks the ability to modify the form state to do redirects etc.

I think the form_submit is a Drupal hook & should use a reference to the form_state?
eg line 557 of dbtng_example.module
function dbtng_example_form_update_submit($form, &$form_state)

Comments

rfay’s picture

I agree that the signature is wrong and should be fixed. Looking forward to your patch!

drew reece’s picture

The dumbest patch I ever spent 20 minutes on … :^)

I think all 3 instances need replacing, but it is unclear to me if they are genuine hooks. Hence the 2 commits.

rfay’s picture

Status: Active » Needs work

Thanks for the patch! A couple of things:

1. When you submit a patch, put it in "Needs review". That tells people to review it and tells the testbot to test it.
2. None of these are hooks. I guess you'd call them handlers.
3. The AJAX callback in fact does *not* call with $form_state called by reference.

drew reece’s picture

Thanks for the tips,
I don't know how to undo & make the correct patch, I tried a git revert, but it seems like I'm getting in a mess with git.
Since this is an example, someone who knows the difference between hooks & handlers should probably do the correct fixes.

It all looks like a jungle to me & I just hack…

rfay’s picture

You were doing great and were on the right track. It's just that the signature for a form submit handler and the AJAX callback is not the same.

I hope you'll continue on trying!

You may want to re-read the Patch workflows section in the git documentation.

If you committed your work, you can do a git log</a> and <code>git reset --hard <hash> to somewhere before the change (and then git pull</a> to catch up again). If you didn't commit it, you can just <code>git reset --hard HEAD to get rid of the stuff you did.

drew reece’s picture

Status: Needs work » Needs review
StatusFileSize
new821 bytes

Hmm,
Lets see how far this gets…
I love git, but at times I really want to murder it.

Status: Needs review » Needs work

The last submitted patch, pass form_state as a reference-1170234-6.patch, failed testing.

drew reece’s picture

Status: Needs work » Needs review
StatusFileSize
new821 bytes

Same patch again with no spaces in filename…

rfay’s picture

Status: Needs review » Fixed

Committed: D7: 506b9b8, D8: 69bef7b

Thanks and congratulations!

drew reece’s picture

Cheers,
maybe one day I'll make it to 4 :^)
http://certifiedtorock.com/u/168163

rfay’s picture

You are on your way! BTW, 3 is nothing to be ashamed of. Definitely on the way up though.

Status: Fixed » Closed (fixed)

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