D
D
Dmitry Losev2018-10-07 17:16:29
Joomla
Dmitry Losev, 2018-10-07 17:16:29

How to select files for each button separately?

Hello!
Help with the form. On this site , there is a form with several buttons for adding files. The website is on Joomla.
When you select a file on the first "Summary" button, the file name is written to the right of the button. And only one file, although there is a multi-upload.
When selecting files using the "Add photo" buttons, nothing appears next to them, but the file name at the first button changes.
It is necessary to make sure that each button has its own file (files). and Accordingly, the division by file type - summary - pdf / word, and photos - pictures. And now it's all together on all the buttons.
I will be very grateful.
Form code:

spoiler
<div id="form">
            <form id="reg_form" style="text/css" method="post" enctype="multipart/form-data">
              <fieldset class="joomly ui-sortable">
              <input type="hidden" name="option" value="com_joomlyform" class="ui-sortable-handle" style="">	
              <input type="hidden" name="page" value="<?php echo $_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"];?>" class="ui-sortable-handle" style="">	
              <input type="hidden" name="ip" value="<?php echo $_SERVER["REMOTE_ADDR"];?>" class="ui-sortable-handle" style="">	
              <input type="hidden" name="form_id" value="anketa" class="ui-sortable-handle" style="">	
              <input type="hidden" name="task" value="add.save" class="ui-sortable-handle" style="">
              <div class="input" data-element="input" data-id="input1" style="display: block;"><label for="input1" style="width: 150px;">Фамилия Имя*</label>...........................................................................

<b>Здесь пропускаю большую часть кода с обычными полями. слишком много символов получается</b>
......................................................................................................................................................................
<b>Прикрепить файл резюме*
(в формате Word или PDF)</b></div><div class="uploader" style="overflow: hidden;" data-element="uploader"><label class="file" style="display: block; background-color: rgb(0, 153, 204); float: left; margin-bottom: 0px; padding: 2px 10px; color: white; border-radius: 4px; width: auto; height: 30px;" for="file">Добавить резюме</label><input type="file" name="filerez[]" accept="application/pdf,application/msword,application/rtf,image/jpeg,image/png,image/gif" id="file" multiple="true" onchange="this.nextSibling.innerHTML = this.value" multiple="multiple" style="visibility: hidden;display:inline-block; height: 40px;  width: 0px; margin-bottom: 0px;"><label style="display: inline-block"></label></div><div class="html" data-element="html" style="display: inline-block;"><b>Прикрепить фотографии (не менее 3 фото)*
<br>Если вы желаете прикрепить более 3 фотографий, вы можете выбрать до 15 шт в каждом поле</b></div><div class="uploader" style="overflow: hidden;" data-element="uploader"><label class="file" style="display:block; background-color: #0099cc; float:left;margin-bottom: 0px;padding: 6px 10px;color:white;-webkit-border-radius: 4px;-moz-border-radius: 4px;border-radius: 4px;width: auto;" for="file">Добавить фото</label><input type="file" name="filefoto1[]" id="file" onchange="this.nextSibling.innerHTML = this.value" multiple="multiple" style="visibility: hidden;display:inline-block; height: 40px;  width: 0px; margin-bottom: 0px;"><label style="display: inline-block"></label></div><div class="uploader" style="overflow: hidden;" data-element="uploader"><label class="file" style="display:block; background-color: #0099cc; float:left;margin-bottom: 0px;padding: 6px 10px;color:white;-webkit-border-radius: 4px;-moz-border-radius: 4px;border-radius: 4px;width: auto;" for="file">Добавить фото</label><input type="file" name="filefoto2[]" id="file" onchange="this.nextSibling.innerHTML = this.value" multiple="multiple" style="visibility: hidden;display:inline-block; height: 40px;  width: 0px; margin-bottom: 0px;"><label style="display: inline-block"></label></div><div class="uploader" style="overflow: hidden;" data-element="uploader"><label class="file" style="display:block; background-color: #0099cc; float:left;margin-bottom: 0px;padding: 6px 10px;color:white;-webkit-border-radius: 4px;-moz-border-radius: 4px;border-radius: 4px;width: auto;" for="file">Добавить фото</label><input type="file" name="filefoto3[]" id="file" onchange="this.nextSibling.innerHTML = this.value" multiple="multiple" style="visibility: hidden;display:inline-block; height: 40px;  width: 0px; margin-bottom: 0px;"><label style="display: inline-block"></label></div><div class="radio" data-element="radio" data-id="radio2"><label><input type="radio" name="soglasie" value="Со спецификой агентства знаком(а) и согласен(а) с Политикой конфиденциальности и обработки данных*" id="radio2" class=""><span>Со спецификой агентства знаком(а) и согласен(а) с Политикой конфиденциальности и обработки данных*</span></label></div><div class="captcha" data-element="captcha"><img src="<?php echo JURI::root();?>components/com_joomlyform/captcha/captcha.php?<?php echo time();?>"><input type="text" style="height:38px;" name="captcha" id="joomly-captcha" placeholder="Введите цифры с картинки"></div><div class="" data-element="button" data-id="button1"><button type="submit" class="" id="button1" style="background-color: rgb(0, 153, 204); height: 35px; padding: 4px 24px;">Отправить</button></div></fieldset>
            </form>
          </div>

Handler code (as far as I understand)
spoiler
defined('_JEXEC') or die;

//require_once __DIR__ . '/helper.php';

$app  = JFactory::getApplication();
$data = $app->getUserState('joomlyform.add.form.data', array());
$app->setUserState('joomlyform.add.form.data', array());
$doc =JFactory::getDocument();
$doc->addStyleSheet('components/com_joomlyform/css/constructor-form.css' );
//$fields = ModFormHelper::getFields();


//require JModuleHelper::getLayoutPath('mod_joomly_form', $params->get('layout', 'default'));
require_once __DIR__ . '/tmpl/default.php';

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question