Make a line of script a clickable event

For Joomla! 4.x Coding related discussions, you could also use: http://groups.google.com/group/joomla-dev-general

Moderators: ooffick, General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
Locked
deltaJ
Joomla! Apprentice
Joomla! Apprentice
Posts: 40
Joined: Sun Oct 07, 2012 2:44 pm

Make a line of script a clickable event

Post by deltaJ » Tue Mar 21, 2023 5:15 pm

I have a line of script that inserts an embedded pdf document inside a Joomla article.
It runs as follows {jxdocembed=filename.pdf} and uses a pdf plugin by Joomxone.

It works fine for a single file but I want to list an archive of 30 or more documents and have the script (which I can hide as a link under a title) only activate when the title is clicked. Otherwise all 30+ documents will open at the same time when the page is opened.

I can do it by embedding a simple link to the document filename and it opens the document when clicked, but it takes the viewer out of the website environment. If there is no way to make the script clickable I do at least have this fall-back solution.

deltaJ
Joomla! Apprentice
Joomla! Apprentice
Posts: 40
Joined: Sun Oct 07, 2012 2:44 pm

Re: Make a line of script a clickable event

Post by deltaJ » Wed Mar 22, 2023 3:36 pm

I did some searching on the internet and found example code of such a line of code that does something simple like printing "You clicked me!" after someone clicks the legend "click here". It works fine inside a Joomla article if I use an extension like "Sourcerer" to place the code.

But if I substitute "jxdocembed=images/folder/filename.pdf" it doesn't work when I click. The code will only work if placed alone inside curly brackets in a Joomla article and fails to work if part of a longer piece of Javascript that includes onclick coding.

What is that code anyway? is it Javascript? or PHP? or something else?

MarkRS
Joomla! Explorer
Joomla! Explorer
Posts: 329
Joined: Thu Oct 29, 2009 8:28 am
Location: UK

Re: Make a line of script a clickable event

Post by MarkRS » Thu Mar 23, 2023 8:29 am

I think you'll find that the problem you're having is due to the third party extension, not Joomla or anything else, which is why you're not getting much response here. You need to go to the plugin builder for an answer.

The thing you're referring to isn't code of any sort, unless you classify html as "code", but putting it inside the curly brackets (probably) makes it a target for plugins to operate on.
It's a community, the more we all contribute, the better it will be.

deltaJ
Joomla! Apprentice
Joomla! Apprentice
Posts: 40
Joined: Sun Oct 07, 2012 2:44 pm

Re: Make a line of script a clickable event

Post by deltaJ » Thu Mar 23, 2023 1:15 pm

Thank you MarkRS. I agree with your conclusion.

I did find that a more widely used “script” {loadmoduleid 129} also doesn’t work if I try to make it clickable with JavaScript in front.

The “script” must be something only Joomla recognises and acts on and it can’t be mixed up with other coding.

Not much demand to make a plugin only to work when clicked on. Thanks to all that took the time to read the post.


Locked

Return to “Joomla! 4.x Coding”