You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Alex Grant (JIRA)" <ji...@apache.org> on 2010/07/05 05:25:49 UTC

[jira] Created: (WICKET-2933) Form.MULTIPART_HINT is not cleared correctly with nested forms

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


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.


[jira] Commented: (WICKET-2933) Form.MULTIPART_HINT is not cleared correctly with nested forms

Posted by "Martin Grigorov (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-2933?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12886412#action_12886412 ] 

Martin Grigorov commented on WICKET-2933:
-----------------------------------------

Running the app here I can see enctype attribute _only_ in StepOne.

What is the relation between the multiPart problem and the check for submitting button ?

The nested form cannot find its submitting button because of this check in org.apache.wicket.markup.html.form.Form.findSubmittingButton():
if ((form != null) && (form.getRootForm() == Form.this)) 
i.e. only the root form can find its submitting button.
I don't know what is the reason for that check.

> 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.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.


[jira] Commented: (WICKET-2933) Form.MULTIPART_HINT is not cleared correctly with nested forms

Posted by "Alex Grant (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-2933?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12886457#action_12886457 ] 

Alex Grant commented on WICKET-2933:
------------------------------------

It's not a browser issue - I have tested Chrome 5, Firefox 3.6 and IE 8 and they all exhibit the same behaviour.

> 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.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.


[jira] Commented: (WICKET-2933) Form.MULTIPART_HINT is not cleared correctly with nested forms

Posted by "Alex Grant (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-2933?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12889996#action_12889996 ] 

Alex Grant commented on WICKET-2933:
------------------------------------

Hi Guillaume,

I'm afraid I'm a Wicket user rather than a Wicket developer. I only know bits and pieces of the internals where I've had to find out due to a Wicket bug or a misunderstanding on my part, so I don't know if your changes are likely to correct other bugs. I would, however, be wary about changing Form so it doesn't use MULTIPART_HINT. I assume that was added for a reason.

Martin, who initially posted above, has just been promoted to core team member, so hopefully he will have time to help us.

Alex

> 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.


[jira] Commented: (WICKET-2933) Form.MULTIPART_HINT is not cleared correctly with nested forms

Posted by "Martin Grigorov (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-2933?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12885301#action_12885301 ] 

Martin Grigorov commented on WICKET-2933:
-----------------------------------------

If I understand correctly you want to submit either of the forms at any time and both of them have to know what is the current multiPart state.
If this is the case then the following patch in your app code should be enough:


--- src/main/java/bugs/HomePage.java	2010-07-05 20:46:02.126710839 +0200
+++ src/main/java/bugs/HomePage.java.new	2010-07-05 20:46:36.638708382 +0200
@@ -16,7 +16,7 @@
 public class HomePage extends WebPage {
 
     public HomePage() {
-        Form<?> form = new Form("form");
+        final Form<?> form = new Form("form");
         add(form);
 
         WizardModel wizardModel = new WizardModel();
@@ -35,7 +35,9 @@
 
             @Override
             public void onActiveStepChanged(IWizardStep newStep) {
-                getForm().setMultiPart(getChildOfType((WizardStep) newStep, FileUploadField.class) != null);
+               boolean isMulti = getChildOfType((WizardStep) newStep, FileUploadField.class) != null;
+               getForm().setMultiPart(isMulti);
+               form.setMultiPart(isMulti);
                 super.onActiveStepChanged(newStep);
             }
         };

i.e. update 'multiPart' for both forms.

> 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
>
>
> 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.


[jira] Commented: (WICKET-2933) Form.MULTIPART_HINT is not cleared correctly with nested forms

Posted by "Alex Grant (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-2933?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12886230#action_12886230 ] 

Alex Grant commented on WICKET-2933:
------------------------------------

Sorry about the delay in responding.

I added the following code to HomePage.java, overriding the newForm method in Wizard

            @Override
            protected <E> Form<E> newForm(String id) {
                return new Form<E>(id) {
                    @Override
                    protected void onSubmit() {
                        // Note only the outer form knows its submitted button, the inner form has no idea.
                        if (form.findSubmittingButton() == null) {
                            throw new RuntimeException("Form submitted, but no button detected.");
                        }
                    }
                };
            }

My StepTwo has this in the outer form (note the enctype attribute)

<form wicket:id="form" id="form9" method="post" action="?wicket:interface=:2:form::IFormSubmitListener::" enctype="multipart/form-data">

I got the 1.0-SNAPSHOT from the repository by adding http://wicketstuff.org/maven/repository to my pom.xml, so it I don't know if it's the exact same snapshot you're using.

> 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.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.


[jira] Updated: (WICKET-2933) Form.MULTIPART_HINT is not cleared correctly with nested forms

Posted by "Alex Grant (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-2933?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alex Grant updated WICKET-2933:
-------------------------------

    Attachment: WICKET-2933-with-Exception.zip

WICKET-2933-with-Exception.zip is your .tar.gz file updated with the changes you requested (as described above).

> 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.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.


[jira] Updated: (WICKET-2933) Form.MULTIPART_HINT is not cleared correctly with nested forms

Posted by "Alex Grant (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-2933?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alex Grant updated WICKET-2933:
-------------------------------

    Attachment: WICKET-2933-with-Exception.zip

The version of WICKET-2933-with-Exception.zip I attached previously included my copy of the target folder, which meant just doing mvn jetty:run was actually running the wrong code. Instead of throwing an Exception it was just printing to the console. Here's a clean version.

> 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.


[jira] Updated: (WICKET-2933) Form.MULTIPART_HINT is not cleared correctly with nested forms

Posted by "Alex Grant (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-2933?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alex Grant updated WICKET-2933:
-------------------------------

    Attachment: WICKET-2933-quickstart.zip

Attached quickstart - WICKET-2933-quickstart.zip

> 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
>
>
> 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.


[jira] Commented: (WICKET-2933) Form.MULTIPART_HINT is not cleared correctly with nested forms

Posted by "Guillaume BITAUDEAU (JIRA)" <ji...@apache.org>.
    [ 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.


[jira] Issue Comment Edited: (WICKET-2933) Form.MULTIPART_HINT is not cleared correctly with nested forms

Posted by "Alex Grant (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-2933?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12885098#action_12885098 ] 

Alex Grant edited comment on WICKET-2933 at 7/4/10 11:30 PM:
-------------------------------------------------------------

I have workaround for this, but it is super-ugly. I overrode Wizard.onActiveStepChanged and used reflection to set Form.multiPart


      was (Author: alexgrant):
    I have workaround for this, but it is super-ugly. I overrode of Wizard.onActiveStepChanged and used reflection to set Form.multiPart

  
> 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
>
>
> 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.


[jira] Commented: (WICKET-2933) Form.MULTIPART_HINT is not cleared correctly with nested forms

Posted by "Alex Grant (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-2933?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12885337#action_12885337 ] 

Alex Grant commented on WICKET-2933:
------------------------------------

Thanks for the suggestion. I just tried it, but it didn't work. The page still renders with enctype="multipart/form-data" even though both Forms have setMultiPart(false) as the inner form still has Form.multiPart = MULTIPART_HINT when the outer form renders onComponentTag.

> 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
>
>
> 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.


[jira] Commented: (WICKET-2933) Form.MULTIPART_HINT is not cleared correctly with nested forms

Posted by "Hudson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-2933?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12902300#action_12902300 ] 

Hudson commented on WICKET-2933:
--------------------------------

Integrated in Apache Wicket 1.4.x #118 (See [https://hudson.apache.org/hudson/job/Apache%20Wicket%201.4.x/118/])
    Form.MULTIPART_HINT is not cleared correctly with nested forms
Issue: WICKET-2933


> 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
>            Assignee: Igor Vaynberg
>             Fix For: 1.4.11, 1.5-M2
>
>         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.


[jira] Commented: (WICKET-2933) Form.MULTIPART_HINT is not cleared correctly with nested forms

Posted by "Alex Grant (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-2933?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12885098#action_12885098 ] 

Alex Grant commented on WICKET-2933:
------------------------------------

I have workaround for this, but it is super-ugly. I overrode of Wizard.onActiveStepChanged and used reflection to set Form.multiPart


> 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
>
>
> 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.


[jira] Commented: (WICKET-2933) Form.MULTIPART_HINT is not cleared correctly with nested forms

Posted by "Alex Grant (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-2933?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12900145#action_12900145 ] 

Alex Grant commented on WICKET-2933:
------------------------------------

This error is still present in Wicket 1.4.10

> 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.


[jira] Resolved: (WICKET-2933) Form.MULTIPART_HINT is not cleared correctly with nested forms

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-2933?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Igor Vaynberg resolved WICKET-2933.
-----------------------------------

         Assignee: Igor Vaynberg
    Fix Version/s: 1.4.11
                   1.5-M2
       Resolution: Fixed

tested with

WICKET-2933-with-Exception.zip	2010-07-08 04:52 PM	Alex Grant	23 kB

be sure to remove any explicit calls to form#setmultipart(), wicket will now correctly calculate this for you

> 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
>            Assignee: Igor Vaynberg
>             Fix For: 1.4.11, 1.5-M2
>
>         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.


[jira] Commented: (WICKET-2933) Form.MULTIPART_HINT is not cleared correctly with nested forms

Posted by "Alex Grant (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-2933?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12886498#action_12886498 ] 

Alex Grant commented on WICKET-2933:
------------------------------------

If I attach a debugger and put breakpoints in Form.onRender, Form.onComponentTag, Form.isMultiPart (inside the Visitor where it sets isMultiPart = true), I see the following behaviour when rendering StepTwo

(outer) Form.onRender - clears this.multiPart
(outer) Form.onComponentTag 
	- isMultiPart() returns true as inner form as multiPart = 2 (MULTIPART_HINT)
	- sets enctype="multipart/formdata"
(inner) Form.onRender - clears this.multiPart

> 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.


[jira] Commented: (WICKET-2933) Form.MULTIPART_HINT is not cleared correctly with nested forms

Posted by "Alex Grant (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-2933?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12902637#action_12902637 ] 

Alex Grant commented on WICKET-2933:
------------------------------------

Thank you very much! Ever since Ajax file uploads were introduced Form.setMultiPart has been a constant source of problems for me, so I'm really glad I don't need to set it explicitly any more.

> 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
>            Assignee: Igor Vaynberg
>             Fix For: 1.4.11, 1.5-M2
>
>         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.


[jira] Commented: (WICKET-2933) Form.MULTIPART_HINT is not cleared correctly with nested forms

Posted by "Hudson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-2933?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12902301#action_12902301 ] 

Hudson commented on WICKET-2933:
--------------------------------

Integrated in Apache Wicket 1.5.x #265 (See [https://hudson.apache.org/hudson/job/Apache%20Wicket%201.5.x/265/])
    Form.MULTIPART_HINT is not cleared correctly with nested forms
Issue: WICKET-2933


> 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
>            Assignee: Igor Vaynberg
>             Fix For: 1.4.11, 1.5-M2
>
>         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.


[jira] Commented: (WICKET-2933) Form.MULTIPART_HINT is not cleared correctly with nested forms

Posted by "Alex Grant (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-2933?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12886473#action_12886473 ] 

Alex Grant commented on WICKET-2933:
------------------------------------

I got a colleague at work to try it and he got the same problem I did.
If it matters, I'm running java 1.6.0_18 on Windows 7.

> 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.


[jira] Commented: (WICKET-2933) Form.MULTIPART_HINT is not cleared correctly with nested forms

Posted by "Alex Grant (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-2933?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12886456#action_12886456 ] 

Alex Grant commented on WICKET-2933:
------------------------------------

That is very odd.

When they multipart problem actually occurs, the HTML has enctype="multipart/form-data" and therefore the browser does a multipart submit. But the Wicket java code is expecting a standard non-multipart submit and therefore cannot find any of the form submit data, including the button parameter (wizard:form:buttons:next = Next >) and thus cannot determine which button was pressed.

> 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.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.


[jira] Updated: (WICKET-2933) Form.MULTIPART_HINT is not cleared correctly with nested forms

Posted by "Martin Grigorov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-2933?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Grigorov updated WICKET-2933:
------------------------------------

    Attachment: wicket-2933.tar.gz

Can you try with wicket-2933.tar.gz ? This is with the modified HomePage.java.
In the page with StepOne wizard tab/panel I can see :
* <script type="text/javascript" id="org.apache.wicket.markup.html.form.Form.form8.metadata"><!--/*--><![CDATA[/*><!--*/
Wicket.Forms["form8"]={multipart:true};  // <- this is the inner form
/*-->]]>*/</script>

* <form wicket:id="form" id="form9" method="post" action="?wicket:interface=:1:form::IFormSubmitListener::" enctype="multipart/form-data"> // <-this is the outer form

* <div wicket:id="form" class="wicketExtensionsWizardForm" id="form8"> // <-this is the inner form

Going to StepTwo shows:
* no more <script> with Wicket.Forms
* outer form: <form wicket:id="form" id="form2" method="post" action="?wicket:interface=:0:form::IFormSubmitListener::">
* inner form is the same

Can you modify the application so that it fails when the condition is wrong? Currently I can browse it all without any failure. 

> 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.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.