We have a custom form set up to publish updates to our intranet, but when a user attaches a document, then submits the form with errors, the form reloads with the error messages displaying at the top, all text fields are maintained, but the attachment is missing.
Does anyone know of a way to maintain the attachment (the attachment is coming through with the email, but isn't being stored in Matrix anywhere - i.e. it is being moved to the trash upon submission).
Custom Form - Attachments lost after submission error
Are your form submitters fixing whatever error generated the form errors and resubmitting without reselecting the file? If so, how is the file attached to emails?
I have noticed the same behaviour, but because the form is not submitted, we do not get the file in any format. I simply put this at the bottom of the form, above the Submit button: "Please check that you have answered all required questions, and that your attachments (if any) are showing, especially if you have received form errors."
Would love to know if there's a fix to keeping that field's entry on errors, though!
[quote]
Are your form submitters fixing whatever error generated the form errors and resubmitting without reselecting the file? If so, how is the file attached to emails?
I have noticed the same behaviour, but because the form is not submitted, we do not get the file in any format. I simply put this at the bottom of the form, above the Submit button: "Please check that you have answered all required questions, and that your attachments (if any) are showing, especially if you have received form errors."
Would love to know if there's a fix to keeping that field's entry on errors, though!
[/quote]
Sorry, I think my original post didn't fully make sense. If they submit it correctly the file is attached to the email, but if they receive errors, it loses the attachment.
I already placed a reminder in the error messages, but I think your idea of putting another reminder near the submit button makes a lot of sense too, and may encourage people to check the form before submitting it with errors.
Definitely a fix needed though. I saw somewhere that there can be form submissions saved without submitting them, so a user can return to complete it. Maybe if there was some sort of autosave function that retained any attachments…?
Presumably a multi-page form with the submit on another page to the attachment would be another option. Though I'm not a fan of having to click past another link just to find 'submit'. Would be interesting to experiment and see if the attachment details were lost this way when there are form errors.
Yes, we already have many problems with users filling out the form incorrectly, and losing the attachments, etc. Adding more pages to the form can only create more problems! Unless it was a sort of confirmation style thing - have the next page button use a 'Submit' label, then have the next page have the actual submit button.
I wonder if storing the attachments in Matrix (as I mentioned, ours puts them straight into the trash, and only attaches to the email) might retain them somehow?
I'm surprised you find yours in trash at all. Ours just don't get submitted. The field empties, so at that point the form has not created a Submission Log yet. The user either re-does that field or doesn't, then submits the form. If they re-do it, the file is handled appropriately, if they don't, there is no file to go straight to Trash as there was no file selected when the form was (correctly) submitted.
I'm really at a loss to wonder how you have a file in trash - when the system theoretically doesn't know about that file at all.
[quote]
I'm surprised you find yours in trash at all. Ours just don't get submitted. The field empties, so at that point the form has not created a Submission Log yet. The user either re-does that field or doesn't, then submits the form. If they re-do it, the file is handled appropriately, if they don't, there is no file to go straight to Trash as there was no file selected when the form was (correctly) submitted.
I'm really at a loss to wonder how you have a file in trash - when the system theoretically doesn't know about that file at all.
[/quote]
Sorry, I confused things again.
Basically it puts the file in the trash upon a successful submission (but also attaches it to the email). It just means we're not maintaining the attachments as assets in Matrix.
But yes, if there are errors, then the user hasn't really submitted anything yet, so no attachment is stored, moved, deleted, attached to an email, etc.
[quote]
Why can't you just Make the file upload a required field?
[/quote]
Because they don't have to upload a file. They can also use a hyperlink, or just describe their request in another text field.
I don't use the feature of 'multiple pages' in a custom form. But if I have to, I would put the file upload question in the last page and cancel the 'confirmation' page.
We have had soo many problems with this. Our form assets do actually attach to an attachment to an email and store the submissions in the submissions folder. However they have no asset type so they are like shadow assets - no URL so even if you try to export them out with the file export tool - you can't. We were original getting mutipage form errors after our upgrade to 4.2.1 however installing Memcache helped fixed this.
We use the multipage form option for these forms with mandatory assets as nic suggests.
I'm wondering whether as soon as the file is attached - it is meant to be sending the assets to the trash - hence when we see them in the submission folder - they have no file type at all. Apparently the files are not being stored in the file system correctly.
There is also a keyword replacement for saving form data as well that you could have in each section.
So yeah any error results in missed attachments. :blink:
They currently work for us- but in a very very no reliable shoddy way.
Any updates on this? Whenever I experience a form error it clears the upload file field. This question is not required so the users are not noticing and submitting the form without an attachment.
This topic is from 5 years ago and a lot has changed since then. I think you are better off starting a new topic with more details on your issue (including Matrix version) or submitting a ticket to Squiz support to look into your problem more closely.