intl-tel-input icon indicating copy to clipboard operation
intl-tel-input copied to clipboard

Hidden fields should not be added if existing already

Open larsblumberg opened this issue 1 year ago • 1 comments

Plugin version

v24.6.0

Steps to reproduce

  1. set hiddenInput: () => ({ phone: "phone_full", country: "phone_country" })`
  2. provide these hidden inputs yourself in the form (there are advantages for certain scripting like referencing these before the library creates them dynamically)

Expected behaviour

  • library does not add hidden inputs a 2nd time, because we already set them up

Actual behaviour

  • value of above inputs gets correctly set
  • but additional hidden inputs are being added

image

Initialisation options

  intlTelInput(input, {
    hiddenInput: () => ({ phone: "phone_full", country: "phone_country" }),
    loadUtilsOnInit: () => import("intl-tel-input/utils"),
  });

larsblumberg avatar Oct 12 '24 22:10 larsblumberg

I'm onboard with this idea. We just need to check if the hidden inputs already exist (within the form) before creating them.

I don't have time to implement this myself right now, but I would welcome a pull request.

jackocnr avatar Oct 13 '24 08:10 jackocnr

Released in v25.0.1

jackocnr avatar Dec 04 '24 18:12 jackocnr