When changing the payment option in the drupal commerce checkout form, the validation fires and throws errors on all fields not filled in it also prevents the form from chaining the fields.

This is a similar issue as reported in http://drupal.org/node/1707032 I think.

Is there a work around for this?

CommentFileSizeAuthor
#5 payment.gif1.02 MBjoelpittet

Comments

jelle_s’s picture

The only workaround for now is to add the class cancel to that button in a hook_form_alter() until the pull request mentioned in #1707032: Make Client side validation not respond to certain input elements like Cancel button with classes other than "cancel". is committed.

attiks’s picture

Status: Active » Closed (duplicate)
roam2345’s picture

Status: Closed (duplicate) » Active

This is not a duplicate as in this case these options are on ajax form elements that are not wired to the submit button on the page, they are toggle options in the payment form. The patch being worked on in issue http://drupal.org/node/1707032 is close to what is needed here how ever it would also need to work on "blur" as to not validate the form element chosen in this case being the payment options.

As an example, I have added the class "cancel" to the option fields in the commerce checkout page (as described in issue http://drupal.org/node/1707032) via the hook_form_FORM_ID_alter() this does not stop the other fields on the form from validation or alter the form changing fields for those of the new payment option when I toggle the payment option on the check out form.

attiks’s picture

This will be hard to support out of the box, we have no idea if the blur is going to submit a form. I had a quick look and they are using Drupal AJAX to bind to the radio elements (without javascript the checkout will probably not work 100%) and Drupal AJAX does a post of the complete form (using form.submit) so it will get validated.

As a workaround you might implement Drupal.ajax.prototype.beforeSubmit to disable the validator.

attiks’s picture

Issue summary: View changes

added more descriptions and fixed typo

joelpittet’s picture

Issue summary: View changes
StatusFileSize
new1.02 MB

ON 2.x and 1.x I'm getting similar with the payment busting the submit button and not reactivating it. Maybe a separate issue?

aaronbauman’s picture

Status: Active » Closed (outdated)

@Joelpittet:
1. this issue is resolved by the still-sandbox module https://www.drupal.org/sandbox/cityreader/2545780
2. your report should go in a new issue

joelpittet’s picture

Thank you @aaronbauman, I've moved it to #2834118: Commerce Payment option change