wapplersystems / form_extended Goto Github PK
View Code? Open in Web Editor NEWTYPO3 extension for extending form
License: GNU General Public License v2.0
TYPO3 extension for extending form
License: GNU General Public License v2.0
Environment
TYPO3 12.4.16
Composer installation
Issue
Multiple upload not working in FE form. Backend Form Generator shows enable multiple uploads
switch.
input looks like this
<input class="form-control" id="angebot-44-fileupload-2" accept="application/pdf" type="file" name="tx_form_formframework[angebot-44][fileupload-2]">
mind the missing multiple
Note: Backend Form Generator preview has this value.
Reproduction
Using Form with File Upload and Enable multiple file upload activated i get the following errors:
Uncaught TypeError: Cannot read properties of undefined (reading 'querySelectorAll')
at FileUpload.js?1718030282:55:55
at NodeList.forEach (<anonymous>)
at FileUpload.js?1718030282:29:46
Uncaught TypeError: Cannot read properties of undefined (reading 'appendChild')
at HTMLInputElement.<anonymous> (FileUpload.js?1718030282:47:59)
Using
TYPO3 12.4.16
form_extended 12.1.3
The error seems to have purely visual effects, namely that the selected files are not displayed as a "tag" with a "delete" button.
It seems that inside Frontend/Partials/FielUpload.html
<f:if condition="{element.properties.multiple}">
<div class="multiupload-files">
<f:if condition="{resources}">
<f:for as="resource" each="{resources}" iteration="iterator">
<span data-target="#{element.uniqueIdentifier}-file-reference-{iterator.index}" class="multiupload-file-block" id="{element.uniqueIdentifier}-preview-{iterator.index}">
<span class="multiupload-file-delete"><span>+</span></span>
<span class="name">{resource.originalResource.originalFile.name}</span>
</span>
</f:for>
</f:if>
</div>
</f:if>
not rendered because {element.properties.multiple} is NULL
The JS for the multiple fileupload uses jQuery. Vanilla JS would be better and future proof.
I will create a PR for this.
The multiple upload does not work because the attribute multiple is filled with {element.properties.multiple} in the template FileUpload.html. It should probably be called {element.properties.enableMulitple}.
I use the modified v12 version of multi_upload -> #19
It works as intended, but if you use the finisher "Delete Uploads" you get an FE error:
Call to a member function getParentFolder() on array
Everything else works: Emails are generated with attachments. No images are saved on Server.
Inside FileUpload.html for the Input Field multiple is set by
multiple="{element.properties.multiple}"
but {element.properties.multiple}
does not exist it is {element.properties.enableMulitple}
and enableMulitple = "FALSE" does not disable multiple Upload
Environment:
Typo3 11.5.22
PHP 8.1.2
form_extended 11.0.0
Hi,
will there be a version for TYPO3 12 in the short term?
Thanks
Stephan
After update to 11.0.8 I get an error 500
TYPO3 11.5.36 - Composer installation
(1/1) ParseError
syntax error, unexpected '|', expecting ';' or '{'
in /var/www/html/public/typo3conf/ext/form_extended/Classes/Mvc/Property/TypeConverter/UploadedFileReferenceConverter.php line 107
While sending files as attachments works like a charm, two other things seem broken.
[concerned versions: the latest on TER and also the latest on github, both being installed in a TYPO3 v11]
I think, these two things are very tightly connected to each other, thus only make one ticket.
The file gets uploaded, but the setting saveToFileMount is completely ignored.
Thus it's always stored in 1:/user_upload/ ... then some folder name "form_%hash"" ...
____EDIT: above problem is resolved with v11.0.8
Remaining problem:
The SaveToDatabase Finisher for file references is broken.
When using the finisher like described in the official docu, it works like a charm without form_extended.
With this ext, the uid_local of sys_file_reference is always just '0' (zero), which breaks the connection between sys_file_reference and sys_file.
Thus I end up in having a broken file reference in DB.
Summary:
I am not sure, but the error might occur in
https://github.com/WapplerSystems/form_extended/blob/release/v11/Classes/Mvc/Property/TypeConverter/UploadedFileReferenceConverter.php
Would be nice to get some info on how to fix.
Here is an example DatabaseFinisher:
https://typo3.slack.com/archives/C093RB4P9/p1698913292146829
If I want to send the uploads as attachments, I always get a getContents error message.
If I only save the files, the following string is displayed in the email for each file:
TYPO3\CMS\Form\Mvc\Property\TypeConverter\PseudoFileReference:
The file is saved in the file system in the folder (as an example) "form_adfaefidfae820f30afef03030d" - it is therefore difficult to assign which folder belongs to which e-mail - it would be best to include a link to the file here, then the folder does not matter.
Wenn ich die Uploads als Anhang verschicken möchte erhalte ich immer eine getContents Fehlermeldung.
Wenn ich die Dateien nur abspeichern lasse, dann wird mir in der E-Mail pro Datei folgender String angezeigt:
TYPO3\CMS\Form\Mvc\Property\TypeConverter\PseudoFileReference:
Abgespeichert wird im Dateisystem im Ordner (als beispiel) "form_adfaefidfae820f30afef03030d" - ist also schlecht zuordenbar welcher Ordner zu welcher E-Mail gehört - hier sollte am besten ein Link zur Datei rein, dann ist auch der Ordner egal.
at TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper->registerArgument('accept', 'array', 'Values for the accept attribute', false, array())
in /app/vendor/wapplersystems/form_extended/Classes/ViewHelpers/Form/UploadedResourceViewHelper.php line 78
Argument "accept" is used twice
$this->registerTagAttribute('accept', 'string', 'Specifies the allowed file extensions to upload via comma-separated list, example ".png,.gif"');
[...]
$this->registerArgument('accept', 'array', 'Values for the accept attribute', false, []);
If the "multiple" attribute is specified with a value of "1", it will be interpreted as a simple "input" field, allowing only a single file to be uploaded.
In the template FileUpload.html it helps if the attribute multiple is filled with the following condition:
multiple="{f:if(condition: '{element.properties.enableMulitple}', then: 'multiple')}"
it would be nice if the Multiple option also exist for ImageUpload
#1297759968 TYPO3\CMS\Extbase\Property\Exception
Exception while property mapping at property path "": Property "0" was not found in target object of type "TYPO3\CMS\Extbase\Domain\Model\FileReference".
at TYPO3\CMS\Extbase\Property\PropertyMapper->convert(array(null, null), 'TYPO3\CMS\Extbase\Domain\Model\FileReference')
in /app/web/typo3conf/ext/form_extended/Classes/ViewHelpers/UploadedResourcesViewHelper.php line 54
return $this->propertyMapper->convert($resource, FileReference::class);
when $resource is array because of multiple file upload.
Environment:
Typo3 11.5.22
PHP 8.1.2
form_extend 11.0.0
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.