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

Uploaded files label

2 weeks 1 day ago #1

  • Omar's Avatar
  • Omar
  • Posts: 2
Good Morning,
I would like to know if there is any way that in the results instead of "Upload file button" it shows the label of the item.

2 weeks 23 hours ago #2

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

Thank you for contacting us!

You need in file ba-about.js (administrator/components/com_baforms/assets/js/ba-about.js)
find code on line 612
let field = obj.files[ind],
                            imageStr = fileStr = '',
                            settings = field.settings ? field.settings.split('_-_') : [0, 1, 2, 'Upload file button;'],
                            options = settings[3].split(';');
And replace the code with this
                        let field = obj.files[ind],
                            imageStr = fileStr = '';
                        filesStr += '<div class="submissions-attachments-row">';
                        filesStr += '<span class="submission-data-label">'+field.title+'</span>';

You need in file submissions.php (administrator/components/com_baforms/models/submissions.php)
find code on line 86
    public function getFiles($id)
    {
        $db = JFactory::getDbo();
        $query = $db->getQuery(true)
            ->select('*')
            ->from('#__baforms_submissions_attachments')
            ->where('submission_id = '.$id);
        $db->setQuery($query);
        $files = $db->loadObjectList();
        $items = new stdClass();
        foreach ($files as $file) {
            if (!isset($items->{$file->field_id})) {
                $query = $db->getQuery(true)
                    ->select('settings')
                    ->from('#__baforms_items')
                    ->where('id = '.$file->field_id);
                $db->setQuery($query);
                $obj = new stdClass();
                $obj->settings = $db->loadResult();
                $obj->files = array();
                $items->{$file->field_id} = $obj;
            }
            $items->{$file->field_id}->files[] = $file;
        }

        return $items;
    }

And replace the code with this
public function getFiles($id)
    {
        $db = JFactory::getDbo();
        $query = $db->getQuery(true)
            ->select('*')
            ->from('#__baforms_submissions_attachments')
            ->where('submission_id = '.$id);
        $db->setQuery($query);
        $files = $db->loadObjectList();
        $items = new stdClass();
        foreach ($files as $file) {
            if (!isset($items->{$file->field_id})) {
                $query = $db->getQuery(true)
                    ->select('*')
                    ->from('#__baforms_items')
                    ->where('id = '.$file->field_id);
                $db->setQuery($query);
                $field = $db->loadObject();
                $obj = new stdClass();
                $obj->settings = isset($field->settings) ? $field->settings : '';
                if (!empty($field->options)) {
                    $params = json_decode($field->options);
                    $obj->title = $params->title;
                } else {
                    $obj->title = 'Upload file button';
                }
                $obj->files = array();
                $items->{$file->field_id} = $obj;
            }
            $items->{$file->field_id}->files[] = $file;
        }

        return $items;
    }

We will add this solution in the next update.

Best Regards,
Vyacheslav, Balbooa Support Team

2 weeks 17 hours ago #3

  • Omar's Avatar
  • Omar
  • Posts: 2
I already made the recommended changes but now it does not show me the results sent

2 weeks 17 hours ago #4

  • Vyacheslav's Avatar
  • Vyacheslav
  • Posts: 16912
Most likely you made a mistake
Send us FTP access and Joomla admin access via our contact form.
support.balbooa.com/contact-us

Regards,
Vyacheslav, Balbooa.com
Powered by Kunena Forum