magento2: Duplicated elements id in checkout page

Preconditions

  1. Magento 2.1.10

Steps to reproduce

  1. Go to Stores -> Configuration -> Sales -> Sales under Gift Options and set both Allow Gift Messages to YES
  2. Put something in cart and go to checkout or cart page

Expected result

  1. Two forms for gift messages having fields with unique ids

Actual result

  1. Two forms for gift messages having fields with non unique ids
[DOM] Found 2 elements with non-unique id #gift-message-whole-from: (More info: https://goo.gl/9p2vKq) <input type=​"text" id=​"gift-message-whole-from" class=​"input-text" data-bind=​"value:​ getObservable('sender')​">​ <input type=​"text" id=​"gift-message-whole-from" class=​"input-text" data-bind=​"value:​ getObservable('sender')​">
[DOM] Found 2 elements with non-unique id #gift-message-whole-to: (More info: https://goo.gl/9p2vKq) <input type=​"text" id=​"gift-message-whole-to" class=​"input-text" data-bind=​"value:​ getObservable('recipient')​">​ <input type=​"text" id=​"gift-message-whole-to" class=​"input-text" data-bind=​"value:​ getObservable('recipient')​">​

Non unique ids alert appears too in checkout payment choice:

[DOM] Found 2 elements with non-unique id #billing-new-address-form: (More info: https://goo.gl/9p2vKq) <fieldset id=​"billing-new-address-form" class=​"fieldset address">​…​</fieldset>​ <fieldset id=​"billing-new-address-form" class=​"fieldset address">​…​</fieldset>​

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 4
  • Comments: 40 (26 by maintainers)

Commits related to this issue

Most upvoted comments

Same situation for me on a new 2.2.3 install.

@angelo983 did you got any solution for this ? I am getting this error in Magento 2.1.8 even when both Allow Gift Messages are set to No

I fixed this isue by changing the following setting in Configuration: Sales - Checkout - Checkout options: Display Billing Address On : -> Set to “Payment page”.

This has solved the issue for me.

Hello @sidolov

As I can see from @julienanquetil code, it fixes only gift message related IDs. What about billing address form? Is it extracted in separate issue?

Hi @angelo983. Thank you for your report. The issue has been fixed in magento/magento2#16264 by @chirag-wagento in 2.1-develop branch Related commit(s):

The fix will be available with the upcoming 2.1.15 release.

Hi @angelo983. Thank you for your report. The issue has been fixed in magento/magento2#15585 by @julienanquetil in 2.2-develop branch Related commit(s):

The fix will be available with the upcoming 2.2.6 release.

HI @bruno-serfe. Yes. I want create a pull-request with update today.