Search

Hello there,

Currently having a problem with input type file fields on a form I’m building, the form has multiple file fields set up on the frontend to allow the user to upload documents to each one, this is currently working fine and the data is being sent to a section set up in the backend, however the problem seems to be if the user decides to come back to add or update the form (which is allowed) it will reset all the previously submitted file field entries and only process that particular submission attempt,

So.. to put it simply, is there any way the already populated file fields could remain populated after additional file field submissions are entered??

Many thanks

You’ll need to use a data source to fetch the information for that entry, and then populate your form fields’ default values with the values returned by that data source.

Nick’s Form Controls XSL utility is a really neat tool for automating a lot of this in your template. Otherwise you can certainly roll your own; it just gets a little more complicated when trying to set the default value for select boxes and whatnot.

With file fields the drill is a bit different: if you want to preserve the file, just pass the filename as a hidden variable in the form. If you look at the Symphony admin area you can see exactly how Symphony solves it, you can apply the exact same thing in your events.

Hi tachyondecay, thanks for the reply, I did what you mentioned and it continues not to work... I did some research and one source told me that input type file fields are unable to have values for security purposes and therefore will not work,

Any ideas?

Thanks Huib, just saw your reply after replying to Ben, will give it a go.

Thanks Huib, using the JS and inspecting the elements from the symphony admin area I was able to solve the problem and now have it working great, thanks again.

Just looking below at the 'Attachments' field on this forum, out of curiosity do you know where I could find the script to perhaps try something similar on my page? this would be much more beneficial to my client as opposed to having multiple separate fields...

I belive the files are related to a forum post via a SBL field. So you have to post to two sections simultaneously. @brendo describes how to do that in https://gist.github.com/901476. You could do the same with a subsection manager field, but this way you would have to save the uploaded files at first, the the parent entry.

This is only the server side. Looking at the JS used here should give you an idea how to implement it in the client side.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details