Joomla 6 Notice

We are pleased to announce that all our Joomla extensions have been compatible with Joomla 6 since October 14th, 2025.

For those currently upgrading from Joomla 3 to 4: Instructions for Joomla 4 migration can be found here:

There are standalone documentations Visforms Joomla 4, Visforms Joomla 5 and Visforms Joomla 6.

Forum

Visforms Subscription user can ask questions in our forum. Please log in with the relevant user first.
Everybody can access the forum for reading.

Please only ask 1 question per topic.

Important information for almost every question:
V1: Which Visforms version is running?
V2: Which Joomla version is running?
V3: Which PHP version is running?

Set "clear-selection" link to always display

More
3 years 4 months ago #8581 by Shaman
Hi devs,

I need to always display the "clear-selection" link on a file input field.
By default it is set to be hidden until a file is selected.

Even by queriing the field after document load, it can't be set to display.

This is the JS is use:
Code:
let clearfiles = document.querySelectorAll(".clear-selection");         for (let i = 0; i < clearfiles.length; i++) {             const clearfile = clearfiles[i];             clearfile.style.display = "block";         }

Can you help me please?

Kind regards,
Claude

More
3 years 4 months ago - 3 years 4 months ago #8582 by Administrator IV
Replied by Administrator IV on topic Set "clear-selection" link to always display
Hello Claude,

it works with the direct setting of the complete HTML attribute 'style'.
In addition, you also have to take care of the existing event handler.
So first remove the existing handler and then attach your own.

Your custom event handler is nothing more than a copy of the original minus the one line that hides the anchor.

The following code works for me:
Code:
jQuery(document).ready(function() {     jQuery('.clear-selection').each(function() {         jQuery(this).attr("style", "display: block;");         jQuery(this).off('click');     });     jQuery("a.clear-selection").on("click", function(e) {         let uploadid = jQuery(this).attr('data-clear-target');         let el = jQuery('#' + uploadid);         el.replaceWith(el.val('').clone(true));         // get the new jQuery object of el         el = jQuery('#' + uploadid);         el.trigger('keyup');         e.preventDefault();         return false;     }); });

Kind regards, Ingmar[/code]

:idea: I recommend you the new and up-to-date documentation for Joomla 6:
docs.joomla-6.visforms.vi-solutions.de/en/docs/
Please ask only 1 question per topic :-).

:idea: Ich empfehle Dir die neue und aktuelle Dokumentation für Joomla 6:
docs.joomla-6.visforms.vi-solutions.de/docs/
Bitte immer nur 1 Frage pro Thema stellen :-).
Last edit: 3 years 4 months ago by Administrator IV.
The following user(s) said Thank You: Shaman

More
3 years 4 months ago #8583 by Shaman
Thank you Ingmar,

this works like a charm :-)

Kind regards,
Claude

Moderators: Administrator AVAdministrator IV
Powered by Kunena Forum