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

Scripts fail with JS event handlers; succeed with jQuery #1319

Open
eschwartz opened this issue Sep 22, 2024 · 1 comment
Open

Scripts fail with JS event handlers; succeed with jQuery #1319

eschwartz opened this issue Sep 22, 2024 · 1 comment

Comments

@eschwartz
Copy link

I am attempting to create a page using an embedded JS script. I am encountering an error where the script fails to publish only if I include JS event handlers (eg. document.getElementById("xyz").onclick = () => {}). When I click publish, I get back a generic HTTP 403 from the server, with a Session Expired - please log in error in the browser.

Bizarrely, if I write the same event handler using jQuery (eg $("#xyz").click(() => {}), publishing succeeds.

I have tried other variations on vanilla JS:

# works
document

# works
document.getElementById("xyz")

# fails
document.getElementById("xyz").onclick = () => {}

# fails
document.onclick = () = {}

# fails
document.getElementById("xyz").onmouseenter = () = {}

# works
$("xyz").click(() => {})

with vanilla JS event handler
Screenshot 2024-09-22 at 3 35 21 PM

with jQuery event handler
Screenshot 2024-09-22 at 3 35 56 PM

I do see this error log on the server:

domain.com/xerte/edithtml.php
PHP Notice: Undefined index: parent_id in /xerte/modules/xerte/edithtml.php on line 219

But looking at that edithtml.php file, it seems unlikely that this error message is related. My guess is that 403 errors are not logged on the server.

Any help would be much appreciated! And thank you for your work on this project.

@torinfo
Copy link
Collaborator

torinfo commented Sep 23, 2024

That is weird. The error occurs in editor/upload.php, but I cannot reproduce this in latest 3.12 nor in latest unstable.
What version of Xerte are you using, and what version of PHP are you running on the server. Is there a way to check the apache/php error log on the server?

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

2 participants