Hi,

I'm trying to use the plupload field in a custom module. At the moment i try to figure out how to set the '#default_value'. Let's say i have an validation error on some other field in the same form and the whole form rebuilds on submit. I would like to keep the files (or temporary files) in the plupload filed so user's don't need to re-upload in case of form validation errors.

On form submit i get data as follow in $form_state['input']:
Screenshot

I couldn't find anything about default values in the modules code itself.

CommentFileSizeAuthor
Screen Shot 2015-08-14 at 11.21.53.png241.46 KBN20
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

N20 created an issue.

slashrsm’s picture

There is no support for #default_value at the moment. I am not sure how #default_value would be expected to work with plupload. Custom forms should take care of files that were already uploaded and make sure they somehow get stored in case of validation fails.

How exactly would #default_value work if we decide to add this feature?

N20’s picture

'#default_value' could probably work like the core image field. I'm not sure how it is managed in the core field but i guess it deals with the files that are in tmp.

slashrsm’s picture

Field widget (what core image field widget is) and form API element (what Plupload element is) are two different things. If you use Plupload with one of the modules (see Plupload project page) that provide field widget around it you get similar experience that is provided by core widget.