Mon. - Fri. 9 am - 5 pm Ask a Question
Remember me

Submit and Download

3 years 2 months ago #1

  • Daniel's Avatar
  • Daniel
  • Posts: 4
Hi. What code can I put in the Submit button so that when send the form, then start downloading a file?

Thanks

3 years 2 months ago #2

  • Vyacheslav's Avatar
  • Vyacheslav
  • Posts: 17947
Hello, Daniel

You need at the custom JS file of your template to add JS code:
function downloadFile()
{
	var a = document.createElement('a');
	a.setAttribute('download', '');
	a.href = '######';
	a.click();
}
replace ###### to url your file( which you need to download )

And at the Form add embed for Submit button.

to add code:
onclick="downloadFile()"

Regards,
Vyacheslav, Balbooa.com

3 years 2 months ago #3

  • Daniel's Avatar
  • Daniel
  • Posts: 4
Excuse my ignorance, but I do not know exactly where the custom JS file is located. I have tried in all the JS files of the template and even in the part of inject code of the framework and it does not work for me. Could I clarify more?
Thank you

3 years 2 months ago #4

  • Artem's Avatar
  • Artem
  • Posts: 9268
Hello,

You need to contact your template provider support, with a question where you can add custom javascript code

Regards,
Artem, Balbooa.com

4 months 1 week ago #5

  • Karol's Avatar
  • Karol
  • Posts: 116
Thank you it works :)
I have one more question. What can I do to get the code
<!-- Google Tag Manager (noscript) -->

<noscript><iframe src="www.googletagmanager.com/ns.html?id=GTM-59LG9RP"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->

was right after the opening <body> tag:?

4 months 1 week ago #6

  • Vyacheslav's Avatar
  • Vyacheslav
  • Posts: 17947
Unfortunately, there is no such possibility.

Best Regards,
Vyacheslav, Balbooa Support Team

4 months 1 day ago #7

  • Alexandr's Avatar
  • Alexandr
  • Posts: 200
Hi !
How to do Submit and Download feature in the new Forms version 2.0.5 ?

4 months 1 day ago #8

  • Vyacheslav's Avatar
  • Vyacheslav
  • Posts: 17947
Hi !

Unfortunately, there is no such possibility.
You can always see the changes that were included in the updates here
www.balbooa.com/joomla-forms-documentation/key-features

We can offer you to make a redirect after sending to the page with the ability to download

Best Regards,
Vyacheslav, Balbooa Support Team

3 months 4 weeks ago #9

  • Cristian's Avatar
  • Cristian
  • Posts: 4
Sorry but I don't understend wher is embed function in ballboa form.
I use Yootheme template and balbooa form component.

I'd tried to insert call function onclick="downloadFile()" in Submit button >PHP script > After Data Submission
but doen't work.

I'd put the code

function downloadFile()
{
var a = document.createElement('a');
a.setAttribute('download', '');
a.href = '######';
a.click();
}

In the script position on my yootheme position. But nothing.
I'd also tryed to put the function in "code editor" >javascript. But nothing.

Where am i wrong, please?

3 months 4 weeks ago #10

  • Vyacheslav's Avatar
  • Vyacheslav
  • Posts: 17947
Hello,

Thank you for contacting us!

You can do it without code.
In the settings of the submit button you need to set a redirect and add a link to the desired file


Best Regards,
Vyacheslav, Balbooa Support Team

3 months 4 weeks ago #11

  • Cristian's Avatar
  • Cristian
  • Posts: 4
thank you very much!

It is possible to have it open the attached file in a target blank page?

3 months 4 weeks ago #12

  • Vyacheslav's Avatar
  • Vyacheslav
  • Posts: 17947
The file will be opened or downloaded,
it depends on the browser (different formats behave differently in browsers)

Regards,
Vyacheslav, Balbooa.com

2 months 3 weeks ago #13

  • Massimiliano's Avatar
  • Massimiliano
  • Posts: 4
Hi, I'm intrested on it.
Ok, but browser open in the same page of web site interrupting the navigation!
Is there a system to force open in a blank page or forcing download (like this <a href="http://link/to/file" download="FileName">Download it!</a>)?

2 months 3 weeks ago #14

  • Vyacheslav's Avatar
  • Vyacheslav
  • Posts: 17947
Hello,

Unfortunately there is no such possibility

Best Regards,
Vyacheslav, Balbooa Support Team
Powered by Kunena Forum