Jako / FormIt2db

FormIt hooks for saving/retreiving XPDO objects in MODX Revolution
https://jako.github.io/FormIt2db/
GNU General Public License v2.0
6 stars 4 forks source link

Dont save file names (strings in CSV) to DB when using with AjaxUpload #9

Closed lapp closed 7 months ago

lapp commented 7 months ago

Hi Jako,

first many thanks for your work on MODx!

Found issue: When using Formit2DB with AjaxUpload I cant save the file names to DB. Consider this Formit call:

[[!FormIt?
   &hooks=`AjaxUpload2Formit,AjaxUploadAttachments,FormItSaveForm,Formit2db,email,FormItAutoResponder,redirect`
   &ajaxuploadFieldname=`filesCSV`
   &arrayFields=`["filesCSV"]`
   ...
   &store=`1`
   &redirectTo=`6822`
]]
<form action="[[~[[*id]]]]" method="post" class="form-horizontal" id="reklamacni-formular">
...
<input type="text" id="filesCSV" name="filesCSV" hidden="hidden">
...
</form>

After submit, string content of "filesCSV" is available in all other hooks (FormItSaveForm, email, FormItAutoResponder, redirect) except for Formit2db.

Would you be so kind and try to check it, please?

Thanks and regards, Mike

lapp commented 7 months ago

Update: It does not work only when using "schema alias key" as name of the input field. When using "schema field key" (DB column name) it works! But again: using "schema alias key" for all other input fields except "ajaxuploadFieldname" works well

lapp commented 7 months ago

Update2: My mistake, you cant use &arrayFields=["filesCSV"]. Now everything works as expected!

Jako commented 7 months ago

Yes, you have to use

   &arrayFields=`filesCSV`
lapp commented 7 months ago

No, its the other way round :-) You can’t use &arrayFields=filesCSVWhen you use it, it doesn’t  work.