Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple Forms Initialization with VGSCollect #88

Open
luizgamabh opened this issue Jul 26, 2024 · 0 comments
Open

Multiple Forms Initialization with VGSCollect #88

luizgamabh opened this issue Jul 26, 2024 · 0 comments

Comments

@luizgamabh
Copy link

Expected Behavior

VGSCollect should allow specifying a unique form ID or a selector for each form initialization, enabling multiple forms to coexist on the same page without conflicts or duplication of fields and event listeners.

Current Behavior

Currently, VGSCollect requires forms to have an ID of "collect-form". When multiple forms with the same ID are present on the page, the first form is initialized multiple times, leading to duplicated fields and event listeners, the other forms are ignored. This not only causes a validation error in HTML but also results in improper handling of form data and events.

Possible Solution

  • Allow passing a form ID or CSS selector in the VGSCollect.create method to specify the scope of initialization.

Steps to Reproduce (for bugs)

  1. Create a page with multiple credit card forms.
  2. Ensure each form has the ID "collect-form".
  3. Initialize VGSCollect for each form using the current API.
  4. Observe that only the first form is initialized, but multiple times, resulting in field duplication and multiple event listeners being attached.

Context

We are integrating VGSCollect on a page with multiple tabs containing forms for adding or managing payment methods. The current limitation with form IDs causes significant issues, including HTML validation errors and improper handling of form interactions. This issue is critical as it affects the usability and security of the payment forms on our platform.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant