[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.
--- 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) {