Skip to content
Browse files
Fixed: Send upload form with even-update-area doesn't work
When you create a xml form with upload as type, you can't use on-event-update-area element to submit it by ajax.
Otherwise, OFBiz return an error message on 'uploadFile is empty.
To solve it, we analyze the enctype's form before submit it to move on FormData instead a direct serialize [1]

example form where the problem has been present
    <form name='AddNicelyFile' type='upload' target='CreateNicelyFile'>
        <field name='uploadedFile' title='File'><file/></field>
        <field name='addButton'><submit/></field>
        <on-event-update-area event-type='submit' area-id='window' area-target='FileDisplaying'/>

Thanks to Samuel Tregouet for this fix


git-svn-id: 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
nmalin committed Sep 24, 2019
1 parent ee95f3b commit e0d640a375b32d6eb117709d0fa92703310b199c
Showing with 18 additions and 2 deletions.
  1. +18 −2 themes/common-theme/webapp/common/js/util/OfbizUtil.js
@@ -686,10 +686,26 @@ function ajaxSubmitFormUpdateAreas(form, areaCsvString) {

var $form = jQuery("#" + form),
data = null,
processData = true,
enctype = $form.attr("enctype"),
contentType = "application/x-www-form-urlencoded; charset=UTF-8";

if (enctype && enctype.indexOf("multipart") !== -1) {
data = new FormData($form[0]);
contentType = false;
processData = false;
} else {
data = $form.serialize();

type: "POST",
url: jQuery("#" + form).attr("action"),
data: jQuery("#" + form).serialize(),
contentType: contentType,
url: $form.attr("action"),
data: data,
processData: processData,
success: function(data) {

0 comments on commit e0d640a

Please sign in to comment.