# HG changeset patch # User Adrien Di Mascio # Date 1252439865 -7200 # Node ID c929360212ca17617ed6ad992279063b558f0639 # Parent f87fd632e3f6c78ee107ae1e624ba0dda49ede84 [forms] fix form enctype handling with inlined forms If an inlined form is added dynamically and contains a file input, the parent form enctype must be set to multiplart/form-data otherwise files won't be uploaded correctly. diff -r f87fd632e3f6 -r c929360212ca web/data/cubicweb.edition.js --- a/web/data/cubicweb.edition.js Tue Sep 08 15:58:47 2009 +0200 +++ b/web/data/cubicweb.edition.js Tue Sep 08 21:57:45 2009 +0200 @@ -255,6 +255,11 @@ updateInlinedEntitiesCounters(rtype); reorderTabindex(); form.trigger('inlinedform-added'); + // if the inlined form contains a file input, we must force + // the form enctype to multipart/form-data + if (form.find('input:file').length) { + form.closest('form').attr('enctype', 'multipart/form-data'); + } postAjaxLoad(dom); }); d.addErrback(function (xxx) {