Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
In the Account Information pane validation, whitespaces are not stripped out. This would give an "invalid email address" error when whitespace exists in the email value. When double entry of email address is required, email values where one has whitespaces at the end would also invalidate.
Comments
Comment #2
akosipax CreditAttribution: akosipax commentedHere's a patch.
Comment #4
rszrama CreditAttribution: rszrama commentedCan we not do this via an element validate handler w/ form_set_value()?
Comment #5
akosipax CreditAttribution: akosipax commentedIs this preferable?
Comment #7
akosipax CreditAttribution: akosipax commentedOops. I didn't pass an array to #element_validate.
Comment #9
akosipax CreditAttribution: akosipax commentedA, sorry. Trying this again.
Comment #10
MrPeanut CreditAttribution: MrPeanut commentedPatch from #9 applies cleanly and works on my site. Thanks!
Comment #11
joelpittetGood call on trimming this, no need to have bad data from simple mistakes.
Comment #12
rszrama CreditAttribution: rszrama at Centarro commentedHonestly, even for "private" functions prefixed w/ an underscore, we should include the module name in the prefix. The validate handler should be renamed
_commerce_order_validate_order_mail()
, and there's no reason to make$trimmed_email
a separate variable really.Comment #13
joelpittetAddressing feedback from #12
Comment #14
rszrama CreditAttribution: rszrama at Centarro commentedAwesome, thanks! I was thinking about it and actually went ahead and dropped the underscore prefix on the off chance other modules create interfaces for order e-mail addresses to be entered and want to reuse the validate handler.