Joomla 5 Notice

We are pleased to announce that as of January 29, 2024, all of our Joomla extensions are compatible with Joomla 5.

For all who are still updateing from Joomla 3 to Joomla 4: Joomla 4 Migration instructions are available here:

There is now a separate Documentation for Visforms for Joomla 4 and for Visforms for Joomla 5!

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.

How to add javascript code in visforms

More
7 years 7 months ago #3563 by cloudyHuang
How to add javascript code in visforms was created by cloudyHuang
Hi ,Aicha

I made a upload file feature use visfroms。and I want to write javascript for the submit button。
just like ->
$(document).ready(function(){
$("#field3").click(function(){
code...
});
});

When I press the submit to upload the file,My javascript will also run。
now I want to know I should write my javascript code in which php file can be achieved。


Thanks

More
7 years 7 months ago #3564 by cloudyHuang
Replied by cloudyHuang on topic How to add javascript code in visforms
I added the code in ../media/com_visforms/js/visforms.js
$("#field3").click(function(){
window.alert('abc');
console.log('abc');
});


but the page no response

More
7 years 7 months ago #3565 by Administrator AV
Replied by Administrator AV on topic How to add javascript code in visforms
Hi,

basically you can create overrides of all files in the components/com_visforms/layouts folder in your template ( www.vi-solutions.de/en/documentations/vi...layout-with-override ) as well as of the files in the components/com_visforms/views/VIEWNAME/tmpl folder. (These are standard Joomla! features). The overrides in your template are not changed, when you update Visforms, so your code would be save there.

Nevertheless, as I'm continiously developing new features and try to improve Visforms, I sadly quite often have to change some of the files mentioned about. So although your overrides are not touched by an update, Visforms may no longer work, because your override file might miss something. So you might be required to adapt your override after a Visforms update. And the changes I make are sometimes quite severe.

I don't know which Visforms version you use, but just in Visforms 3.8.9 which was release only days ago, I added an option to the file upload field, which allows you to dynamically add a "remove selection" link to the upload field if a user has made a selection. So mayby this is just the feature you are looking for? Then maybe try Visforms 3.8.9. But as this is still a beta version, please make a full backup of your website first, so that you can return to the old state, if you are not happy with Visforms 3.8.9.

Visforms relies very much on and uses lots of Javascript (especially for the browser side form validation). I actually do not recommend to try to add custom javascript to Visforms (especially to the submit button) because this button strongly interacts with the validator plugin and your code will most probably not work as expected.

Regards,
Aicha

:idea: I recommend you the new and up-to-date documentation for Joomla 4:
docs.joomla-5.visforms.vi-solutions.de/en/docs/
Most of this also applies retrospectively to Joomla 3.
Please only ask 1 question per topic :-).

:idea: Ich empfehle Dir die neue und aktuelle Dokumentation für Joomla 4:
docs.joomla-5.visforms.vi-solutions.de/docs/
Das meiste gilt rückwirkend auch für Joomla 3.
Bitte immer nur 1 Frage pro Thema stellen :-).

Moderators: Administrator AVAdministrator IV
Powered by Kunena Forum