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.
Inline errors landed in core recently. When combined with the price field, the result is not good, because the currency selector is pushed to the next row (instead of the error itself being below both the amount/currency and description rows).
We need to see if we can move the placement of the error (or tweak the css to achieve what we need), or move the error to the parent form (making sure it doesn't go more than 1 level above, to account for Inline Entity Form).
Comment | File | Size | Author |
---|---|---|---|
#7 | commerce_price-fix-inline-form-errors-on-price-element-2509702-7.patch | 1.75 KB | jsacksick |
| |||
#7 | price-inline-validation-after-patch.png | 19.09 KB | jsacksick |
#5 | inline-form-errors-product.png | 129.43 KB | jsacksick |
price-inline-error.png | 22.4 KB | bojanz |
Comments
Comment #1
bojanz CreditAttribution: bojanz at Centarro commentedInline errors were reverted and moved to an optional module.
Comment #2
pramod_patil CreditAttribution: pramod_patil at Faichi Solutions Pvt Ltd commentedComment #3
mglamanIt is an experimental module now.
Comment #4
bojanz CreditAttribution: bojanz at Centarro commentedNo longer experimental, needs to be retested.
Comment #5
jsacksick CreditAttribution: jsacksick at Centarro commentedInline errors look terrible on all our fields that have a selector (the selector is pushed to the next row), see screenshot below:
Comment #6
jsacksick CreditAttribution: jsacksick at Centarro commentedIt is possible to disable inline errors for some elements by adding the following flag to a form element:
'#error_no_message' => TRUE
but we should of course better find a way to fix it :).
Comment #7
jsacksick CreditAttribution: jsacksick at Centarro commentedSo, I found a solution to fix this by setting the
#error_no_message
flag on the number element, and by adding a element validate callback on the price element itself...After patch:
Comment #8
mglamanWe should see if this can be abstracted into https://github.com/drupalcommerce/commerce/blob/8.x-2.x/src/Element/Comm... as some kind of helper.
Comment #9
bojanz CreditAttribution: bojanz at Centarro commentedI told Jonathan to hold off with a helper until we have an actual second use case. Smaller risk of misabstraction that way.
I got up to speed with IFE again, and it has made little progress since the 8.0.x days. I've confirmed that Jonathan's fix is the only sensible one.
I did want two changes:
1) Rename validatePrice() to moveInlineErrors() to make it obvious what's happening
2) Perform the move only when IFE is enabled. That way the non-IFE use case doesn't regress.
Comment #11
bojanz CreditAttribution: bojanz at Centarro commentedThere we go. Thanks, Jonathan.