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 DatePickers Generate Duplicate Scripts Leading to JavaScript Errors #18

Open
byStrange opened this issue Aug 15, 2024 · 0 comments · May be fixed by #17
Open

Multiple DatePickers Generate Duplicate Scripts Leading to JavaScript Errors #18

byStrange opened this issue Aug 15, 2024 · 0 comments · May be fixed by #17

Comments

@byStrange
Copy link

What steps will reproduce the problem?

Render multiple instances of the DateTimePicker widget on the same page.
Ensure that each instance has a unique ID.
Observe the rendered HTML and JavaScript.

What is the expected result?

Each DateTimePicker instance should initialize independently without causing JavaScript errors due to conflicting variable declarations. The JavaScript generated for each date picker instance should be isolated to prevent conflicts.

What do you get instead?

When rendering multiple DateTimePicker instances, the generated JavaScript scripts for each date picker contain identical variable names and constants. This results in JavaScript errors such as "Uncaught SyntaxError: Identifier 'config' has already been declared" due to the redeclaration of variables. The script registration process may also cause duplicate script registrations.

Additional info

Q A
Version 0.1.0 (latest)
PHP version 8.1.12
Operating system ubuntu 23.04
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

Successfully merging a pull request may close this issue.

1 participant