How to hide a link

keroman

Member
I would like to hide in a list view the href url value in the status bar when mouse hover the link label. In words, I want to implement with fabrik a something like the following line of code:

<a href="javascript:void(0)" onclick="location.href="'.$mylink.'">Link</a>

$mylink is the concatenation of index.php?id= and a list_name___element_name value.

I have tried the following:

- I type "javascript:void(0)" as custom link in the list view settings tab of my link element.
- I create a X.js file in the com_fabrik/js folder with the following code:

function link() {
var useridname = Fabrik.getBlock('form_X').formElements.get('list_name___element_name');
useridval = useridname.get('value');
url = "index.php?rowid=" + encodeURIComponent(useridval);
location.href="url";
}

(X is the number of the form where the link element is located)

- I initialize the "link" function with the following settings in the javascript tab of my link element:

. event: click.
. javascript code: link();

The scheme however doesn't work. Nothing is happening when I click on the label of my link in a list view.

What did I wrong ? If my scheme cannot work, how can I implement this in Fabrik ?
 
What happens for people who don't have js enabled? If js is enabled, people will still see the link when they go to the page, I'm confused as to why you want to circumnavigate what is a core feature of the internet and html :)
 
I agree with Rob - in fact I would go further to say that I would not click on such a link - if I can't see the URL and am not sure where I am going, then I don't click.

That said, you can probably use the Display plugin if the link is constant, or use the sformat display field or create a calc field to generate the HTML you want.
 
rob:

1- You are right but how many people are now disabling JS ?
2- The real link of the page - which comprise variables - is also hidden. I make a redirect on a generic link (the $mylink) just after getting the variables and setting it as session variables using JFactory/getSession.
The aim of that scheme is to display clean and uninformative (thus more secure) url.

Sophist:

I don't think it will be major obstacle as JS is widely used to hide email address for example.
 
That may be true, however people are also widely using javascript blockers (like adblockplus) to selectively block JS from sites (because JS is the most widely exploited way of doing naughty things).
 
To answer the original question, I'm pretty sure the Javascript events in the Element settings only apply to form view, not list view.

Also, if you want a JS file to be included in a list view page, it needs to be called ./js/list_X.js, not ./js/X.js.

So you'd probably need to roll your own domready event in a list_X.js file, which selects all the elements you need, and add the click events to them.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top