Closed (fixed)
Project:
Commerce Core
Version:
7.x-1.x-dev
Component:
Checkout
Priority:
Normal
Category:
Task
Assigned:
Issue tags:
Reporter:
Created:
1 Jul 2010 at 03:58 UTC
Updated:
3 Jan 2014 at 01:42 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
rszrama commentedI believe Damien has done this, but we still need to implement the AJAX loading of the same page...
Comment #2
rszrama commentedLet's decide if this needs to happen for RC1, too. We've survived so long without it that I'm not sure it's necessary...
Comment #3
damien tournoud commentedWe are nearly there. There is actually one small change necessary here: when a form fails validation (for example because a required element is not present) no pane are processed.
Fixing this looks easy, see the 7.x-1.x-842292 branch.
Comment #4
rszrama commentedCross linking a duplicate issue: #1289014: Custom checkout pane custom form validation expects abnormal validation behavior
Comment #5
damien tournoud commentedComment #6
damien tournoud commentedHere is a reroll.
Comment #7
damien tournoud commentedThis patch moves the pane validation / submit logic from a form submit where it currently lies to a form validate.
This allow us to properly validate and submit panes independently one from the other. One visible change for this is that error messages related to required fields are now properly showing attached to every pane:
Comment #9
rszrama commentedI've attached an update that'll pass the testbot (conflict with the recently committed patch to fix messages in checkout). I also brought back the submit handler to actually handle message restoring between page redirects and to set the redirect URL. This code came after an if check in the old handler that required validation to pass... so it was basically the actual submission part of the old submit handler.
The only thing I don't know is if you'd want me to clear the submit handlers at the end of the checkout form builder function like you do for the validate handlers. Interested to see what the test bost says. My local tests all worked great.
Comment #11
rszrama commentedJust a note to say that I'm debugging those fails; as far as I can tell, they're related to the fact that making validation actually happen in a validation handler now means we have to accommodate AJAX posts which, in the case of the failing test, only includes an update to a country. If this is changed on the same page as an invalid e-mail address, we don't have the proper contents in the messages array in the form state for the pane.
Comment #12
rszrama commentedAlrighty, what was happening was this code was replacing the stored messages array with rendered HTML at a time when that stored messages array would still need to be accessed again in a subsequent AJAX validation in which the previous errors are still present:
It could be we don't need to store the themed output in the form state or even that we could work some bypass into this during AJAX validation, but I'm trying to preserve the intent of the original patch by just putting the themed output in a separate 'themed_messages' array.
Also, I went ahead and set the form level #submit handlers like you did for #validate.
All clear, test bot and Damien bot?
Comment #14
rszrama commented#12: 842292-12.checkout_validate.patch queued for re-testing.
Comment #16
rszrama commentedTest bot is out of disk space. Just as well since I had a typo. :-/
Comment #17
rszrama commentedIn case that fails provisioning again, this passed testing locally. If I don't hear any negative feedback, I'll commit this later today. It doesn't change any logic from your original patch that I can see and simply moves the submit handlery type stuff into a legit submit handler.
Comment #18
rszrama commentedCommit: http://drupalcode.org/project/commerce.git/commitdiff/0e0beff