Forums

Need help

mike80925 30 Apr, 2014
I need to replace an old form that was used to send links to end users so they can download files from my server. The name of that program sme_filemailer.

Basically one of my employees would go to this form, select a file name from a drop down menu, enter the persons name and there email address. Once they hit the submit button that would then send the customer an email containing a link to download a file from my server.

I used this because we did not want the employees to just send any file they wanted and we wanted all the emails to come from one email address. So that our customers would not get the email address for our employees.
Max_admin 01 May, 2014
Hi Mike,

That's very simple, just create a new form, setup your email with the file link, and use the "dynamic to" feature to send it to the email address in the form field.

Regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
GreyHead 01 May, 2014
Hi mike80925,

What exactly do you need help with.

There's no great difficulty in doing this with ChronoForms.

a) I'd set the form up with the select drop down in the On Load event using options like
file_name_a.pdf=Tutorial on topic 19
...

b) In the Onsubmit event add an email action with
<a href='some_url/{drop_down_name}' >Click here to down load </a>
Clearly you might add bells and whistles to validate the selection but that is the basic part.

Bob
mike80925 01 May, 2014
I guess what I am having trouble with is, Is there a way to auto populate the drop down? Or will I have to manually add each file. Can I have more than one drop-down to choose a file from?
mike80925 01 May, 2014
Here is an image of the current form
GreyHead 01 May, 2014
Answer
1 Likes
Hi mike80925,

Yes, you can autopopulate the drop-down. I'd probably do it from a DB table and use another form and listing to manage that but you could equally do it from a text file. This FAQ should help.

And, yes, you can have more than one drop-down, you just have to manage the results to extract the file name to use.

Bob
mike80925 01 May, 2014
Is there a more in-depth walk thought somewhere?
GreyHead 01 May, 2014
Hi mike80925,

A more detailed walk-through of which part exactly? Every form is a bit different, I've built one (out of hundreds) that is like yours so there may be details on parts but not the whole.

Bob
mike80925 01 May, 2014
I am still pretty new to most of this so as much help as possible would be great. I can make a form just fine it the rest I was looking for a bit more instruction on.
GreyHead 01 May, 2014
Hi mike80925,

Ok so step 1 is: Where are the file names and how are you going to manage them?

Bob
GreyHead 01 May, 2014
Hi Mike80925,

OK so step 1 is: Where are the file names and how do you plan to manage them?

Bob

PS FYI here is the other form I built like this.
mike80925 01 May, 2014
The files are going to be PDF's and zip files. They are going to be stored on the same server not sure of the folder name yet just that it will be outside of my web folders.
GreyHead 01 May, 2014
Hi mike80925,

That's the file storage part, I was more interested in managing the file names and titles.

Bob
mike80925 02 May, 2014
Sorry for the delay

Here are some examples for the file names

Firmware drop down
Product A firmware XX.XX.XX.zip
Product b firmware XX.XX.XX.zip
Product c firmware XXX.XX.XXX.zip

Drivers drop down
Product a driver.zip
Product b driver.zip

Manuals Dropdown
Product A manual.pdf
Product c manual.pdf

Other
Product A User manual.iso
Product B instructionsto.pdf

Basiclly they will look something like that. There are over 20 or thirty files currently in that folder.
GreyHead 03 May, 2014
HI Mike,

That's a step forward. Next - how, in Joomla! do you want to link up the file names and titles so that you can access them to build the drop-downs you want?

Bob
mike80925 03 May, 2014
Not sure I understand the question
Max_admin 05 May, 2014
Here is an example for the manuals dropdown, just add the following to the "options" box:

product_a_manual.pdf
product_b_manual.pdf
product_c_manual.pdf

And name that dropdown "manual", then use the following code in your email template:

you can download the manual here:
<a href="http://domain.com/manuals/{manual}">{manual}</a>

I have assumed that all your manuals files are under this path:
http://domain.com/manuals/

Regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
GreyHead 05 May, 2014
Hi Mike,

Max's answer is one way of adding the file names to a drop-down (though his solution doesn't send an email).

If you are happy to manage the options manually that is fine. My understanding was that you wanted to pick up the names and titles automatically from some place or other. I just have no idea what place.

Bob
mike80925 06 May, 2014
I have not decided exactly were I will store the files yet. You are correct I do want the file names to populate on there own.
mike80925 23 May, 2014
I still haven't figured this out any ideas.
Max_admin 24 May, 2014
How do you want to retrieve the files names then ? by scanning a folder or a directory on your web server ?
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
mike80925 26 May, 2014
Yes, I want to fill dropdown from a folder on my web server.
Max_admin 27 May, 2014
Hi Mike,

Ok, please add a "custom code" action before the "html" action and insert this code:

<?php
$files = \GCore\Libs\Folder::getFiles("path to folder here");
foreach($files as $k => $file){
$form->data["files"][$k]["name"] = $file;
}

Then, under the "dynamic data" tab in your dropdown, do this:
#1- enable it.
#2- under the path, enter "files".
#3- under both text and id, just enter "name".

That should do what you want, but remember to change the folder path!

Regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
mike80925 28 May, 2014
I get the following error when I try the form [attachment=0]Capture3.PNG[/attachment]
Max_admin 28 May, 2014
The "Data Path" should be set to "files"
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
mike80925 28 May, 2014
How do I stop it from showing the entire file path?
mike80925 29 May, 2014
When I add the following custom code all of my drop downs work. However when I specify a folder after the File_mailer_admin folder in the path of this code the code stops working. Or what I should say the part that will continue to work is the dropdown for "drivers" folder. all of the other three dropdowns than give an error.

<?php
 $files = \GCore\Libs\Folder::getFiles("C:\Program Files (x86)\Ampps\www\joomla30\components\com_chronoforms5\chronoforms\uploads\File_mailer_admin");
 foreach($files as $k => $firmware){
 $form->data["files"][$k]["name"] = $firmware;
 }
 
 $files2 = \GCore\Libs\Folder::getFiles("C:\Program Files (x86)\Ampps\www\joomla30\components\com_chronoforms5\chronoforms\uploads\File_mailer_admin");
 foreach($files2 as $k => $drivers){
 $form->data["files2"][$k]["name2"] = $drivers;
 }
 
 $files3 = \GCore\Libs\Folder::getFiles("C:\Program Files (x86)\Ampps\www\joomla30\components\com_chronoforms5\chronoforms\uploads\File_mailer_admin");
 foreach($files3 as $k => $manuals){
 $form->data["files3"][$k]["name3"] = $manuals;
 }
 
  $files4 = \GCore\Libs\Folder::getFiles("C:\Program Files (x86)\Ampps\www\joomla30\components\com_chronoforms5\chronoforms\uploads\File_mailer_admin");
 foreach($files4 as $k => $other){
 $form->data["files4"][$k]["name4"] = $other;
 }
?>
Max_admin 30 May, 2014
Hi Mike,

You can hide the full path by changing this line:
$form->data["files"][$k]["name"] = $file;

To:
$form->data["files"][$k]["name"] = basename($file);


I'm not sure about the 2nd issue, but isn't it expected to have different paths for the different groups of files ?

Regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
mike80925 30 May, 2014
Thanks for the display path fix. It worked great. But Yes, I do want to have different folders for each drop down. but like I said when I add the folder name after the \File_mailer_admin folder i still get the same errors on the page except for the drivers drop-down. Is there something else I can try or share so you can possibly see what I am doing wrong?
Max_admin 02 Jun, 2014
What's the error you get ?

You don't have to change the key/text strings as well:
$form->data["files2"][$k]["name2"] = $drivers;

should be
$form->data["files"][$k]["name"] = $drivers;


Regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
mike80925 02 Jun, 2014
even if I have more than one drop down i don't need to change those?
Max_admin 03 Jun, 2014
No, you only need to change the "Data path", in the code and under the drop down settings, but everything else should be fine as its!

Regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
mike80925 10 Jun, 2014
I am still getting the follow error only on my first drop down.

Warning: array_combine() expects parameter 1 to be array, null given in C:\Program Files (x86)\Ampps\www\joomla30\administrator\components\com_chronoforms5\chronoforms\actions\html\html.php(125) : eval()'d code on line 4
mike80925 10 Jun, 2014
I believe I fixed it. It appears that when i changed the destination folder name to something other than "firmware" it worked. Because I changed the folder name to upgrades and than my form was able to pull the names of files from that folder and when I changed it back it I got the same error as above. I can live with the new folder name now that is working. Now I need to be able to have someone click submit and have the form email a link to download this file.
Max_admin 11 Jun, 2014
Maybe your folder was empty ?

Just use {field_name} in the email to display the path selected!
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
mike80925 11 Jun, 2014
No the folder is not empty
This topic is locked and no more replies can be posted.