[
https://issues.apache.org/jira/browse/WICKET-2933?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12889892#action_12889892
]
Guillaume BITAUDEAU commented on WICKET-2933:
---------------------------------------------
Alex, I found exactly the same problem.
Here my correction :
* in Form.java :
{quote}
private boolean isMultiPart() {
if (multiPart != 0) {
return true;
}
final boolean[] anyEmbeddedMultipart = new boolean[] { false };
visitChildren(Form.class, new IVisitor<Form>() {
public Object component(Form form) {
boolean isMultiPart = false;
if (form.isVisibleInHierarchy() && (form.multiPart != 0)) {
isMultiPart = true;
}
if (isMultiPart == true) {
anyEmbeddedMultipart[0] = true;
return STOP_TRAVERSAL;
}
return CONTINUE_TRAVERSAL;
}
});
visitFormComponents(new FormComponent.AbstractVisitor() {
@Override
public void onFormComponent(FormComponent<?> formComponent) {
if (formComponent.isVisibleInHierarchy() &&
formComponent.isMultiPart()) {
anyEmbeddedMultipart[0] = true;
}
}
});
return anyEmbeddedMultipart[0];
}
{quote}
and
{quote}
protected void onRender(final MarkupStream markupStream) {
super.onRender(markupStream);
}
{quote}
* In my use case, I don't need wizard, but modal windows ... I need the
following correction in ModalWindow.java to get it works :
{quote}
private class WindowClosedBehavior extends AbstractDefaultAjaxBehavior {
private static final long serialVersionUID = 1L;
@Override
protected void respond(AjaxRequestTarget target) {
////////////////////////////////////////
//GBI WICKET-2933
//add :
getContent().setVisible(false);
////////////////////////////////////////
shown = false;
...
{quote}
I think this modification in modal window can correct other bugs .... What do
you think ?
> Form.MULTIPART_HINT is not cleared correctly with nested forms
> --------------------------------------------------------------
>
> Key: WICKET-2933
> URL: https://issues.apache.org/jira/browse/WICKET-2933
> Project: Wicket
> Issue Type: Bug
> Components: wicket
> Affects Versions: 1.4.9
> Reporter: Alex Grant
> Attachments: WICKET-2933-quickstart.zip,
> WICKET-2933-with-Exception.zip, WICKET-2933-with-Exception.zip,
> wicket-2933.tar.gz
>
>
> I have a page that looks like this
> * Page
> ** Form
> *** Wizard (contains another Form)
> **** StepOne - contains a FileUploadField
> **** StepTwo - has no FileUploadField
> (The outer form is there because I have some controls outside the wizard that
> needed to submit the wizard too).
> Because I have been using Ajax ModalDialogs, it has been important to get
> Form.multipart set correctly (otherwise they don't submit back correctly). So
> I override Wizard.onActiveStepChanged and checked to see if the new wizard
> step contained a FileUploadField, and set Form.setMultiPart accordingly.
> However, this only clears Form.MULTIPART_HARD, Form.MULTIPART_HINT is left
> untouched.
> When I step from StepOne to StepTwo, the inner form still has MULTIPART_HINT
> set as it contained a FileUploadField last render. Then the outer form's
> onRender fires, which clears MULTIPART_HINT, then the outer form's
> onComponentTag fires. When it checks isMultiPart(), it evaluates to true as
> the nested Form still returns true from its MULTIPART_HINT, and therefore
> tag.put("enctype", "multipart/form-data"); is executed. After that, the inner
> form's onRender fires which clears its MULTIPART_HINT.
> When I try to submit StepTwo, the html has enctype="multipart/form-data", so
> it does a multipart submit. But wicket is not expecting a multipart submit so
> it doesn't find any of the submitted form data, and cannot determine which
> button is pressed, and loses all the form content.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.