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

Variable type "DOM Element" cannot extract values of "input" tags #889

Open
MichaelRoosz opened this issue Sep 22, 2024 · 3 comments
Open

Comments

@MichaelRoosz
Copy link

When trying to extract the (current) value of an "input" tag, the "DOM Element" variable type will fail, even when configured to use the attribute name "value".

This is because we use "getAttribute()" to obtain the value, which does not return the current value, just the initial one.

return node.getAttribute(attributeName);

I am willing to contribute a fix for this, but I would like to know if and how you would like to fix this.

@MichaelRoosz
Copy link
Author

As a workaround I created a Tag Manager extension plugin:
https://github.com/MichaelRoosz/plugin-TagManagerInputExtension

It provides a variable to read input values and a trigger for input changes.
However, in case you would like to adjust the "DOM Element" variable, I would still be willing to work on a fix for it.

@snake14
Copy link
Contributor

snake14 commented Sep 22, 2024

Hi @MichaelRoosz . Thank you for taking the time to create this issue and share what you've worked on. As the DOM method is getElementAttribute I think that returning the attribute value makes sense. Maybe a new getElementProperty method should be added to the DOM class. What do you think @AltamashShaikh ?

@MichaelRoosz just skimming over your plugin, I think that it looks pretty good. You're always welcome to submit those triggers and variables in a PR for our tag manager repository. We're happy to look at any PRs that you'd like to submit.

@AltamashShaikh
Copy link
Contributor

@snake14 A PR from @MichaelRoosz would be better, as it solves the problem

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

3 participants