Hello! Issue has been solved by the following code. What do you think about inclusion of it into official wicket code?
/** * Update Form EncType to "multipart/form-data" of there is something which require multipart is in target ajax response */ public class FixFormEncTypeListener extends AjaxRequestTarget.AbstractListener { @Override public void onAfterRespond(Map<String, Component> map, IJavaScriptResponse response) { Set<Form<?>> formsToUpdate = new HashSet<>(); for (Map.Entry<String, Component> entry : map.entrySet()) { Component component = entry.getValue(); Form<?> form = component.findParent(Form.class); if(form!=null && form.isMultiPart()) formsToUpdate.add(form.getRootForm()); } for (Form<?> form : formsToUpdate) { response.addJavaScript("{var e = document.getElementById('"+form.getMarkupId()+"'); e.encoding= 'multipart/form-data'; e.encType=e.encoding;}"); } } } Thanks, Ilya --------------------------------------------- Orienteer(http://orienteer.org) - open source Business Application Platform On Mon, Sep 5, 2016 at 2:32 AM, Илья Нарыжный <phan...@ydn.ru> wrote: > It will not solve the problem... Component which want to be mutatable > doesn't want to know about parent forms. So forms in ajax mode should > somehow adjust encoding automatically, but resending of whole content of a > form is not good option, imho. > > Thanks, > > Ilya > > --------------------------------------------- > Orienteer(http://orienteer.org) - open source Business Application > Platform > > > On Mon, Sep 5, 2016 at 1:29 AM, Maxim Solodovnik <solomax...@gmail.com> > wrote: > >> Maybe you can use nested forms? >> >> On Mon, Sep 5, 2016 at 2:51 PM, Илья Нарыжный <phan...@ydn.ru> wrote: >> >> > Hello! >> > >> > Please help to figure out is there some good solution for the following >> > situation: >> > >> > There is a page with Form with in it. Form contains lots of components >> > underneath. And some components can be changed by AJAX from "view" >> > representation to "edit". And sometimes "edit" is some file upload >> > component. And in this case to work proporly: form encoding should be >> > changed to multipart. But I don't want to make it by sending in ajax >> > response whole Form, because it's pretty big... Is there a good way >> update >> > just a component and if parent form is not multipart - switch it to >> > multipart? >> > >> > Thanks, >> > >> > Ilya >> > >> > --------------------------------------------- >> > Orienteer(http://orienteer.org) - open source Business Application >> > Platform >> > >> >> >> >> -- >> WBR >> Maxim aka solomax >> > >