This forum is no longer open and is for reading/searching only.
Please use our new MachForm Community Forum instead.
MachForm Community Forums » MachForm 2
Select Files to download
Started 15 years ago by matthewnoyes | 4 posts |
-
I have a form where I would like to upload files to be available for users to download, but I do not want them to download all of the files for the form. Is there a away to populate a checkbox list with the files that have been uploaded so the user can select the files, the information can be collected and user can select which files they would like emailed to them or the link included in there receipt email..
Posted 15 years ago # -
Do you want to create a "check box" list with uploaded file list from another form (upload form) ? or the check box and upload file field is in the same form ?
MachForm Support
Posted 15 years ago # -
Sorry, I was out of town a couple of days.
The Check Box List and the upload file list is part of the same form.Posted 15 years ago # -
I think you can customize "includes/helper-functions.php" file for this.
For example you have form 1 with check box (element 4) and 3 upload field (element 1~ 3). I assume that, when a user select first check box option (element_4_1), they will get upload field 1 link in the mail. Try to follow these steps :1. Edit the file and go to line 232 for this code:
$email_body = '';
then put these code exactly bellow that line
if ($form_id == 1) { $res = do_query("select element_4_1,element_4_2,element_4_3 from ap_form_{$form_id} where id='{$entry_id}'"); $row_select = do_fetch_result($res); }
2. Go to around line 349 ~ 358 for these code :
if($data['element_type'] == 'textarea'){ $data['value'] = nl2br($data['value']); }elseif ($data['element_type'] == 'file'){ if($target_is_admin === false){ $data['value'] = strip_tags($data['value']); }else{ $data['value'] = strip_tags($data['value'],'<a>'); } }
and change those code with this one
if($data['element_type'] == 'textarea'){ $data['value'] = nl2br($data['value']); }elseif ($data['element_type'] == 'file'){ if ($form_id == 1) { if ($data['element_id'] == 1 && $row_select['element_4_1'] == 0 ) { continue; } elseif ($data['element_id'] == 2 && $row_select['element_4_2'] == 0 ) { continue; } elseif ($data['element_id'] == 3 && $row_select['element_4_3'] == 0 ) { continue; } } if($target_is_admin === false){ $data['value'] = strip_tags($data['value']); }else{ $data['value'] = strip_tags($data['value'],'<a>'); } }
Don't forget to change those id's with yours. That would send the link in email notification based on selected check box.
MachForm Support
Posted 15 years ago #
Reply
You must log in to post.