Skip to content

Multiple DatePickers Generate Duplicate Scripts Leading to JavaScript Errors #18

Open
@byStrange

Description

@byStrange

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions