Forum
Two issues with Perch Forms
I am setting up a few forms on a site, and just want to save all the information to the perch app for later use.
The first is for a competition, where the user uploads a photo and then explains something about it. When I comment out the file upload, all the other information is stored fine, when I put it back in, nothing is saved, none of the user details, etc. Once I successfully uploaded a file to the required directory, but I have not been able to replicate that again. I have checked the filetypes.ini and it is all fine.
<perch:label for="fileupload">label</perch:label><br/>
<perch:input type="file" id="fileupload" accept="pdf jpg jpeg png" label="File" />
That is the code for the submission. All the other inputs are just text/email.
The second form is more of a questionnaire, where the user writes detailed responses to some questions, which we then want to save to perch forms for a potential competition down the track. There are 3 text boxes, and the form submits fine and add's all the details, but only saves about 10 words of the text area response/
<perch:label for="about">Please provide a brief introduction about yourself</perch:label>
<perch:input id="about" type="textarea" name="about" label="About" size="l" required />
That is the code for one of the textareas in the form.
Thanks in advance.
In general to help we need:
Sorry about that.
Full Templates (removed classes for readability):
Issue 1
Issue 2
And the Diagnostic report:
Thank you again
The values in the
accept
attribute relate to the section heading inperch/config/filetypes.ini
. It looks like you're specifying file extensions instead.Try:
Success! Thank you.
Whilst this thread is still going, is there anyway to use Dropzone.js to replace the file upload button?
Yes, I think that should probably work. It'll require some configuration, though. The Forms app is expecting the fields and the files to be sent in one request, so you'll need to queue the file upload in your dropzone configuration (
autoProcessQueue: false
I think). Add an event handler to the form to catch the submission, and at that point have dropzone process the queue and send your form fields at the same time (processQueue()
)So the file uploads were working last night, and today I added styling classes to the form and uploads no longer work.
Everything is pretty much the same as yesterday, apart from the classes.
Ok. That doesn't really sound like something I can help with then.
It turns out it is the AJAX call. I chose not too use Dropzone, but I'm guessing the file needs to get added to a Queue and then submitted with the form. SerializeArray would not work for this would it?
This is what my AJAX call looks like currently. Is there a setting I need to update on the actual form input to enable a queue?
As long as the file is submitted with the form fields you should be fine. I can't really offer JavaScript help.