Incompatiblility with ajax

Created on 5 May 2022, about 3 years ago
Updated 12 May 2025, 4 days ago

Problem/Motivation

When the element is loaded in ajax request (e.g. clicking edit address in commerce checkout) there is a buggy behavior. The element is loaded with a default value but when you submit the form the value is cleared and you lose the data or get a validation error if the element is required.

Steps to reproduce

  • Set up commerce site with telephone field in customer profile.
  • Add a product to cart and go to checkout.
  • Fill in billing profile with the telephone number and proceed to the next step.
  • Go back and click edit address.
  • Submit the form (go to next step).

I have been trying to debug this a little and found out that in phone_international.js script after ajax request the field variable contains a different object (there is also a placeholder attribute missing and maybe other differences). I inserted the console.log call after the line no. 49 and the console outputs for normal vs. after ajax call state are attached as images.

Drupal.behaviors.PhoneInternational.alterPhoneLibraryOptions(field, options);
console.log(field);
πŸ› Bug report
Status

Closed: cannot reproduce

Version

3.0

Component

Code

Created by

πŸ‡ΈπŸ‡°Slovakia gresko8

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024