Problem/Motivation

Adding multiple google tag ID on the setting form is saving only first ID.

Steps to reproduce

  1. Visit path: admin/config/services/google-tag
  2. Enter google tag ID and click on add another Id button.
  3. Enter 3-4 google tag ID and click on SAVE button

Remaining tasks

All Google tag ID's should be saved properly in the settings and configuration form at first instance.

Issue fork google_tag-3482534

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

ankitv18 created an issue. See original summary.

japerry made their first commit to this issue’s fork.

japerry’s picture

Status: Active » Fixed

Confirmed. Each tag ID textfield has its own #ajax on change, and that request races the "Add another ID" and "Save" clicks. With Add, its rebuild can leave a stale form behind, so the next Save keeps only the first ID. With Save, the textfield is disabled while its request runs, so the ID you just typed isn't submitted.

I opened MR !157:

  • Removed the per-field Ajax. "Add another ID" rebuilds the whole form like "Remove" does, so the GTM advanced settings still update, just after add/remove/save instead of on blur.
  • IDs are saved in weight order without being keyed by weight, so rows with the same weight don't overwrite each other.
  • Blank rows are dropped, and saving with no ID at all is rejected.
  • The textfield gets an invisible title. Without one, a server-side format failure fataled instead of showing a validation message.
  • The help text now lists GTM- and GT- IDs and says to save (or add another ID) before configuring a GTM ID's advanced settings, from MR !120 in #3544836: Can't save Google Tag ID.
  • Added a FunctionalJavascript test that adds four IDs (it fails on 2.0.x), plus kernel tests for weight order, duplicate weights and blank rows.

Fixed!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

  • japerry committed bafa8aba on 2.0.x
    fix: #3482534 Save every tag ID when Add another or Save is clicked...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.