You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Sven Meier (JIRA)" <ji...@apache.org> on 2011/01/28 17:17:44 UTC

[jira] Created: (WICKET-3404) Improve ModalWindow form handling

Improve ModalWindow form handling
---------------------------------

                 Key: WICKET-3404
                 URL: https://issues.apache.org/jira/browse/WICKET-3404
             Project: Wicket
          Issue Type: Improvement
          Components: wicket-extensions
    Affects Versions: 1.5-RC1
            Reporter: Sven Meier


Currently ModalWindow's javascript generates a generic <form> tag into the page.
This is done to support nested forms while preventing temporary invalid HTML markup in the browser, i.e. a form nested in a another form.

IMHO this is rather inelegant, which manifests itself in the following note in ModalWindow's javadoc:
"If you want to use form in modal window component make sure that you put the modal window itself in another form (nesting forms is legal in Wicket) ..."
I'm always having a hard time to explain this sentence to Wicket newcomers.

My proposal: Let go of the <form> tag in javascript with the attached patch!

The changed code now adds ModalWindow's markup first into the HTML page and then replaces its content *directly* with the component's markup to show in the modal window (the current implementation does it the other way around).

The proposed change would require a migration effort for some usages of ModalWindow though. Forms inside a ModalWindow inside another form have to be 'made root forms', either by overriding isRootForm() and getRootForm() or perhaps we could introduce a new interface (e.g. IFormSeparator) which signals to a form that its containment in another form doesn't make it a nested form.

Note that this issue is not about esthetics only, we have reocurring usecases in our projects (a form inside a modal window inside another *multipart* form) which require quirks to make it work. I can provide more information on this if required.

Further note that even standard form submits are now possible on ModalWindows too (might be interesting for multipart uploads directly initiated from a ModalWindow's form).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WICKET-3404) Improve ModalWindow form handling

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

Igor Vaynberg updated WICKET-3404:
----------------------------------

    Fix Version/s: 1.6.0

this is something we should tackle in 1.6 since it will also change how people use the modal with regard to wrapping it in form, etc.

> Improve ModalWindow form handling
> ---------------------------------
>
>                 Key: WICKET-3404
>                 URL: https://issues.apache.org/jira/browse/WICKET-3404
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket-extensions
>    Affects Versions: 1.5-RC1
>            Reporter: Sven Meier
>             Fix For: 1.6.0
>
>         Attachments: ModalWindow.patch, ModalWindow_v2.patch
>
>
> Currently ModalWindow's javascript generates a generic <form> tag into the page.
> This is done to support nested forms while preventing temporary invalid HTML markup in the browser, i.e. a form nested in a another form.
> IMHO this is rather inelegant, which manifests itself in the following note in ModalWindow's javadoc:
> "If you want to use form in modal window component make sure that you put the modal window itself in another form (nesting forms is legal in Wicket) ..."
> I'm always having a hard time to explain this sentence to Wicket newcomers.
> My proposal: Let go of the <form> tag in javascript with the attached patch!
> The changed code now adds ModalWindow's markup first into the HTML page and then replaces its content *directly* with the component's markup to show in the modal window (the current implementation does it the other way around).
> The proposed change would require a migration effort for some usages of ModalWindow though. Forms inside a ModalWindow inside another form have to be 'made root forms', either by overriding isRootForm() and getRootForm() or perhaps we could introduce a new interface (e.g. IFormSeparator) which signals to a form that its containment in another form doesn't make it a nested form.
> Note that this issue is not about esthetics only, we have reocurring usecases in our projects (a form inside a modal window inside another *multipart* form) which require quirks to make it work. I can provide more information on this if required.
> Further note that even standard form submits are now possible on ModalWindows too (might be interesting for multipart uploads directly initiated from a ModalWindow's form).

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (WICKET-3404) Improve ModalWindow form handling

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

Chris Colman commented on WICKET-3404:
--------------------------------------

Any chance this fix could make it into 1.5 instead of waiting till 1.6?

I get problems with IE8 as well - DateTimeField breaks badly.

We also have some modal forms with tabbed windows - so the 'modal window in form' work around/intended design won't work for us I don't believe.

In any case I've tried the add the form 'wrapping' the modal like this but it makes no difference. Have I wrapped it correctly or am I missing something:

	<form>
		<div wicket:id="modalWindow_0"></div>
	</form>




> Improve ModalWindow form handling
> ---------------------------------
>
>                 Key: WICKET-3404
>                 URL: https://issues.apache.org/jira/browse/WICKET-3404
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket-extensions
>    Affects Versions: 1.5-RC1
>            Reporter: Sven Meier
>            Assignee: Sven Meier
>             Fix For: 1.6.0
>
>         Attachments: ModalWindow.patch, ModalWindow_v2.patch
>
>
> Currently ModalWindow's javascript generates a generic <form> tag into the page.
> This is done to support nested forms while preventing temporary invalid HTML markup in the browser, i.e. a form nested in a another form.
> IMHO this is rather inelegant, which manifests itself in the following note in ModalWindow's javadoc:
> "If you want to use form in modal window component make sure that you put the modal window itself in another form (nesting forms is legal in Wicket) ..."
> I'm always having a hard time to explain this sentence to Wicket newcomers.
> My proposal: Let go of the <form> tag in javascript with the attached patch!
> The changed code now adds ModalWindow's markup first into the HTML page and then replaces its content *directly* with the component's markup to show in the modal window (the current implementation does it the other way around).
> The proposed change would require a migration effort for some usages of ModalWindow though. Forms inside a ModalWindow inside another form have to be 'made root forms', either by overriding isRootForm() and getRootForm() or perhaps we could introduce a new interface (e.g. IFormSeparator) which signals to a form that its containment in another form doesn't make it a nested form.
> Note that this issue is not about esthetics only, we have reocurring usecases in our projects (a form inside a modal window inside another *multipart* form) which require quirks to make it work. I can provide more information on this if required.
> Further note that even standard form submits are now possible on ModalWindows too (might be interesting for multipart uploads directly initiated from a ModalWindow's form).

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (WICKET-3404) Improve ModalWindow form handling

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

Martin Grigorov updated WICKET-3404:
------------------------------------

    Fix Version/s:     (was: 6.0.0-beta2)
    
> Improve ModalWindow form handling
> ---------------------------------
>
>                 Key: WICKET-3404
>                 URL: https://issues.apache.org/jira/browse/WICKET-3404
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket-extensions
>    Affects Versions: 1.5-RC1
>            Reporter: Sven Meier
>            Assignee: Sven Meier
>         Attachments: ModalWindow.patch, ModalWindow_v2.patch
>
>
> Currently ModalWindow's javascript generates a generic <form> tag into the page.
> This is done to support nested forms while preventing temporary invalid HTML markup in the browser, i.e. a form nested in a another form.
> IMHO this is rather inelegant, which manifests itself in the following note in ModalWindow's javadoc:
> "If you want to use form in modal window component make sure that you put the modal window itself in another form (nesting forms is legal in Wicket) ..."
> I'm always having a hard time to explain this sentence to Wicket newcomers.
> My proposal: Let go of the <form> tag in javascript with the attached patch!
> The changed code now adds ModalWindow's markup first into the HTML page and then replaces its content *directly* with the component's markup to show in the modal window (the current implementation does it the other way around).
> The proposed change would require a migration effort for some usages of ModalWindow though. Forms inside a ModalWindow inside another form have to be 'made root forms', either by overriding isRootForm() and getRootForm() or perhaps we could introduce a new interface (e.g. IFormSeparator) which signals to a form that its containment in another form doesn't make it a nested form.
> Note that this issue is not about esthetics only, we have reocurring usecases in our projects (a form inside a modal window inside another *multipart* form) which require quirks to make it work. I can provide more information on this if required.
> Further note that even standard form submits are now possible on ModalWindows too (might be interesting for multipart uploads directly initiated from a ModalWindow's form).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Assigned] (WICKET-3404) Improve ModalWindow form handling

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

Sven Meier reassigned WICKET-3404:
----------------------------------

    Assignee: Sven Meier

> Improve ModalWindow form handling
> ---------------------------------
>
>                 Key: WICKET-3404
>                 URL: https://issues.apache.org/jira/browse/WICKET-3404
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket-extensions
>    Affects Versions: 1.5-RC1
>            Reporter: Sven Meier
>            Assignee: Sven Meier
>             Fix For: 1.6.0
>
>         Attachments: ModalWindow.patch, ModalWindow_v2.patch
>
>
> Currently ModalWindow's javascript generates a generic <form> tag into the page.
> This is done to support nested forms while preventing temporary invalid HTML markup in the browser, i.e. a form nested in a another form.
> IMHO this is rather inelegant, which manifests itself in the following note in ModalWindow's javadoc:
> "If you want to use form in modal window component make sure that you put the modal window itself in another form (nesting forms is legal in Wicket) ..."
> I'm always having a hard time to explain this sentence to Wicket newcomers.
> My proposal: Let go of the <form> tag in javascript with the attached patch!
> The changed code now adds ModalWindow's markup first into the HTML page and then replaces its content *directly* with the component's markup to show in the modal window (the current implementation does it the other way around).
> The proposed change would require a migration effort for some usages of ModalWindow though. Forms inside a ModalWindow inside another form have to be 'made root forms', either by overriding isRootForm() and getRootForm() or perhaps we could introduce a new interface (e.g. IFormSeparator) which signals to a form that its containment in another form doesn't make it a nested form.
> Note that this issue is not about esthetics only, we have reocurring usecases in our projects (a form inside a modal window inside another *multipart* form) which require quirks to make it work. I can provide more information on this if required.
> Further note that even standard form submits are now possible on ModalWindows too (might be interesting for multipart uploads directly initiated from a ModalWindow's form).

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (WICKET-3404) Improve ModalWindow form handling

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

Stijn de Witt commented on WICKET-3404:
---------------------------------------

For people coming here because they are having issues with (nested) forms in modal windows, please refer to WICKET-1826 where I have written a detailed comment with analysis of how it works and suggested a workaround for that issue.
                
> Improve ModalWindow form handling
> ---------------------------------
>
>                 Key: WICKET-3404
>                 URL: https://issues.apache.org/jira/browse/WICKET-3404
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket-extensions
>    Affects Versions: 1.5-RC1
>            Reporter: Sven Meier
>            Assignee: Sven Meier
>         Attachments: ModalWindow.patch, ModalWindow_v2.patch
>
>
> Currently ModalWindow's javascript generates a generic <form> tag into the page.
> This is done to support nested forms while preventing temporary invalid HTML markup in the browser, i.e. a form nested in a another form.
> IMHO this is rather inelegant, which manifests itself in the following note in ModalWindow's javadoc:
> "If you want to use form in modal window component make sure that you put the modal window itself in another form (nesting forms is legal in Wicket) ..."
> I'm always having a hard time to explain this sentence to Wicket newcomers.
> My proposal: Let go of the <form> tag in javascript with the attached patch!
> The changed code now adds ModalWindow's markup first into the HTML page and then replaces its content *directly* with the component's markup to show in the modal window (the current implementation does it the other way around).
> The proposed change would require a migration effort for some usages of ModalWindow though. Forms inside a ModalWindow inside another form have to be 'made root forms', either by overriding isRootForm() and getRootForm() or perhaps we could introduce a new interface (e.g. IFormSeparator) which signals to a form that its containment in another form doesn't make it a nested form.
> Note that this issue is not about esthetics only, we have reocurring usecases in our projects (a form inside a modal window inside another *multipart* form) which require quirks to make it work. I can provide more information on this if required.
> Further note that even standard form submits are now possible on ModalWindows too (might be interesting for multipart uploads directly initiated from a ModalWindow's form).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (WICKET-3404) Improve ModalWindow form handling

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

Martin Grigorov updated WICKET-3404:
------------------------------------

    Fix Version/s:     (was: 6.0.0-beta1)
                   6.0.0-RC1
    
> Improve ModalWindow form handling
> ---------------------------------
>
>                 Key: WICKET-3404
>                 URL: https://issues.apache.org/jira/browse/WICKET-3404
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket-extensions
>    Affects Versions: 1.5-RC1
>            Reporter: Sven Meier
>            Assignee: Sven Meier
>             Fix For: 6.0.0-RC1
>
>         Attachments: ModalWindow.patch, ModalWindow_v2.patch
>
>
> Currently ModalWindow's javascript generates a generic <form> tag into the page.
> This is done to support nested forms while preventing temporary invalid HTML markup in the browser, i.e. a form nested in a another form.
> IMHO this is rather inelegant, which manifests itself in the following note in ModalWindow's javadoc:
> "If you want to use form in modal window component make sure that you put the modal window itself in another form (nesting forms is legal in Wicket) ..."
> I'm always having a hard time to explain this sentence to Wicket newcomers.
> My proposal: Let go of the <form> tag in javascript with the attached patch!
> The changed code now adds ModalWindow's markup first into the HTML page and then replaces its content *directly* with the component's markup to show in the modal window (the current implementation does it the other way around).
> The proposed change would require a migration effort for some usages of ModalWindow though. Forms inside a ModalWindow inside another form have to be 'made root forms', either by overriding isRootForm() and getRootForm() or perhaps we could introduce a new interface (e.g. IFormSeparator) which signals to a form that its containment in another form doesn't make it a nested form.
> Note that this issue is not about esthetics only, we have reocurring usecases in our projects (a form inside a modal window inside another *multipart* form) which require quirks to make it work. I can provide more information on this if required.
> Further note that even standard form submits are now possible on ModalWindows too (might be interesting for multipart uploads directly initiated from a ModalWindow's form).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (WICKET-3404) Improve ModalWindow form handling

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

Remus Pereni commented on WICKET-3404:
--------------------------------------

I would also appreciate improving the handling of the form tag inside the modal window.

While I do understand the simplicity of having the form already defined, that prevents the scenario in which you can have a tabbed interface inside of a modal window,  where in each tab you can have a form. In this scenario it is impossible to make the form element the parent of the modal window with direct result in having forms declared inside forms.

Having a form declared inside another form while incorrect according to specifications works on almost every browser, with one little annoying exception, IE7 and innerHTML manipulations of the DOM which results in unexpected JavaScript errors. As a simple use case, having Visural Wicket Rich Text editor component *uses Nickedit which usess innerHTML a lot)  inside a form from the Modal Window in IE7.

> Improve ModalWindow form handling
> ---------------------------------
>
>                 Key: WICKET-3404
>                 URL: https://issues.apache.org/jira/browse/WICKET-3404
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket-extensions
>    Affects Versions: 1.5-RC1
>            Reporter: Sven Meier
>         Attachments: ModalWindow.patch
>
>
> Currently ModalWindow's javascript generates a generic <form> tag into the page.
> This is done to support nested forms while preventing temporary invalid HTML markup in the browser, i.e. a form nested in a another form.
> IMHO this is rather inelegant, which manifests itself in the following note in ModalWindow's javadoc:
> "If you want to use form in modal window component make sure that you put the modal window itself in another form (nesting forms is legal in Wicket) ..."
> I'm always having a hard time to explain this sentence to Wicket newcomers.
> My proposal: Let go of the <form> tag in javascript with the attached patch!
> The changed code now adds ModalWindow's markup first into the HTML page and then replaces its content *directly* with the component's markup to show in the modal window (the current implementation does it the other way around).
> The proposed change would require a migration effort for some usages of ModalWindow though. Forms inside a ModalWindow inside another form have to be 'made root forms', either by overriding isRootForm() and getRootForm() or perhaps we could introduce a new interface (e.g. IFormSeparator) which signals to a form that its containment in another form doesn't make it a nested form.
> Note that this issue is not about esthetics only, we have reocurring usecases in our projects (a form inside a modal window inside another *multipart* form) which require quirks to make it work. I can provide more information on this if required.
> Further note that even standard form submits are now possible on ModalWindows too (might be interesting for multipart uploads directly initiated from a ModalWindow's form).

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (WICKET-3404) Improve ModalWindow form handling

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

Stijn de Witt commented on WICKET-3404:
---------------------------------------

@Chris Colman:

You are missing something. The trick is to wrap the modal window in a *Wicket form*, so Wicket knows about the nesting of forms which is happening. Change your markup to something like:

  <form wicket:id="modalForm"> 
    <div wicket:id="modalWindow_0"></div> 
  </form>

And then in the Java code, create a Form component and add the modal window to that instead of directly to the page:

    ModalWindow modalWindow = new ModalWindow("modalWindow");
    Form modalForm = new Form("modalForm");
    modalForm.add(modalWindow);
    add(modalForm);

                
> Improve ModalWindow form handling
> ---------------------------------
>
>                 Key: WICKET-3404
>                 URL: https://issues.apache.org/jira/browse/WICKET-3404
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket-extensions
>    Affects Versions: 1.5-RC1
>            Reporter: Sven Meier
>            Assignee: Sven Meier
>         Attachments: ModalWindow.patch, ModalWindow_v2.patch
>
>
> Currently ModalWindow's javascript generates a generic <form> tag into the page.
> This is done to support nested forms while preventing temporary invalid HTML markup in the browser, i.e. a form nested in a another form.
> IMHO this is rather inelegant, which manifests itself in the following note in ModalWindow's javadoc:
> "If you want to use form in modal window component make sure that you put the modal window itself in another form (nesting forms is legal in Wicket) ..."
> I'm always having a hard time to explain this sentence to Wicket newcomers.
> My proposal: Let go of the <form> tag in javascript with the attached patch!
> The changed code now adds ModalWindow's markup first into the HTML page and then replaces its content *directly* with the component's markup to show in the modal window (the current implementation does it the other way around).
> The proposed change would require a migration effort for some usages of ModalWindow though. Forms inside a ModalWindow inside another form have to be 'made root forms', either by overriding isRootForm() and getRootForm() or perhaps we could introduce a new interface (e.g. IFormSeparator) which signals to a form that its containment in another form doesn't make it a nested form.
> Note that this issue is not about esthetics only, we have reocurring usecases in our projects (a form inside a modal window inside another *multipart* form) which require quirks to make it work. I can provide more information on this if required.
> Further note that even standard form submits are now possible on ModalWindows too (might be interesting for multipart uploads directly initiated from a ModalWindow's form).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (WICKET-3404) Improve ModalWindow form handling

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

Berlin Brown commented on WICKET-3404:
--------------------------------------

Yes please, I have had issues with this open browsers (Google chrome, Firefox)

> Improve ModalWindow form handling
> ---------------------------------
>
>                 Key: WICKET-3404
>                 URL: https://issues.apache.org/jira/browse/WICKET-3404
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket-extensions
>    Affects Versions: 1.5-RC1
>            Reporter: Sven Meier
>             Fix For: 1.6.0
>
>         Attachments: ModalWindow.patch, ModalWindow_v2.patch
>
>
> Currently ModalWindow's javascript generates a generic <form> tag into the page.
> This is done to support nested forms while preventing temporary invalid HTML markup in the browser, i.e. a form nested in a another form.
> IMHO this is rather inelegant, which manifests itself in the following note in ModalWindow's javadoc:
> "If you want to use form in modal window component make sure that you put the modal window itself in another form (nesting forms is legal in Wicket) ..."
> I'm always having a hard time to explain this sentence to Wicket newcomers.
> My proposal: Let go of the <form> tag in javascript with the attached patch!
> The changed code now adds ModalWindow's markup first into the HTML page and then replaces its content *directly* with the component's markup to show in the modal window (the current implementation does it the other way around).
> The proposed change would require a migration effort for some usages of ModalWindow though. Forms inside a ModalWindow inside another form have to be 'made root forms', either by overriding isRootForm() and getRootForm() or perhaps we could introduce a new interface (e.g. IFormSeparator) which signals to a form that its containment in another form doesn't make it a nested form.
> Note that this issue is not about esthetics only, we have reocurring usecases in our projects (a form inside a modal window inside another *multipart* form) which require quirks to make it work. I can provide more information on this if required.
> Further note that even standard form submits are now possible on ModalWindows too (might be interesting for multipart uploads directly initiated from a ModalWindow's form).

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Comment Edited] (WICKET-3404) Improve ModalWindow form handling

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

Stijn de Witt edited comment on WICKET-3404 at 11/19/12 5:17 PM:
-----------------------------------------------------------------

@Chris Colman:

You are missing something. The trick is to wrap the modal window in a *Wicket form*, so Wicket knows about the nesting of forms which is happening. Change your markup to something like:

  <form wicket:id="modalForm"> 
    <div wicket:id="modalWindow"></div> 
  </form>

And then in the Java code, create a Form component and add the modal window to that instead of directly to the page:

    ModalWindow modalWindow = new ModalWindow("modalWindow");
    Form modalForm = new Form("modalForm");
    modalForm.add(modalWindow);
    add(modalForm);

                
      was (Author: stijndewitt):
    @Chris Colman:

You are missing something. The trick is to wrap the modal window in a *Wicket form*, so Wicket knows about the nesting of forms which is happening. Change your markup to something like:

  <form wicket:id="modalForm"> 
    <div wicket:id="modalWindow_0"></div> 
  </form>

And then in the Java code, create a Form component and add the modal window to that instead of directly to the page:

    ModalWindow modalWindow = new ModalWindow("modalWindow");
    Form modalForm = new Form("modalForm");
    modalForm.add(modalWindow);
    add(modalForm);

                  
> Improve ModalWindow form handling
> ---------------------------------
>
>                 Key: WICKET-3404
>                 URL: https://issues.apache.org/jira/browse/WICKET-3404
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket-extensions
>    Affects Versions: 1.5-RC1
>            Reporter: Sven Meier
>            Assignee: Sven Meier
>         Attachments: ModalWindow.patch, ModalWindow_v2.patch
>
>
> Currently ModalWindow's javascript generates a generic <form> tag into the page.
> This is done to support nested forms while preventing temporary invalid HTML markup in the browser, i.e. a form nested in a another form.
> IMHO this is rather inelegant, which manifests itself in the following note in ModalWindow's javadoc:
> "If you want to use form in modal window component make sure that you put the modal window itself in another form (nesting forms is legal in Wicket) ..."
> I'm always having a hard time to explain this sentence to Wicket newcomers.
> My proposal: Let go of the <form> tag in javascript with the attached patch!
> The changed code now adds ModalWindow's markup first into the HTML page and then replaces its content *directly* with the component's markup to show in the modal window (the current implementation does it the other way around).
> The proposed change would require a migration effort for some usages of ModalWindow though. Forms inside a ModalWindow inside another form have to be 'made root forms', either by overriding isRootForm() and getRootForm() or perhaps we could introduce a new interface (e.g. IFormSeparator) which signals to a form that its containment in another form doesn't make it a nested form.
> Note that this issue is not about esthetics only, we have reocurring usecases in our projects (a form inside a modal window inside another *multipart* form) which require quirks to make it work. I can provide more information on this if required.
> Further note that even standard form submits are now possible on ModalWindows too (might be interesting for multipart uploads directly initiated from a ModalWindow's form).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] Updated: (WICKET-3404) Improve ModalWindow form handling

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

Sven Meier updated WICKET-3404:
-------------------------------

    Attachment: ModalWindow_v2.patch

updated to latest revision

> Improve ModalWindow form handling
> ---------------------------------
>
>                 Key: WICKET-3404
>                 URL: https://issues.apache.org/jira/browse/WICKET-3404
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket-extensions
>    Affects Versions: 1.5-RC1
>            Reporter: Sven Meier
>         Attachments: ModalWindow.patch, ModalWindow_v2.patch
>
>
> Currently ModalWindow's javascript generates a generic <form> tag into the page.
> This is done to support nested forms while preventing temporary invalid HTML markup in the browser, i.e. a form nested in a another form.
> IMHO this is rather inelegant, which manifests itself in the following note in ModalWindow's javadoc:
> "If you want to use form in modal window component make sure that you put the modal window itself in another form (nesting forms is legal in Wicket) ..."
> I'm always having a hard time to explain this sentence to Wicket newcomers.
> My proposal: Let go of the <form> tag in javascript with the attached patch!
> The changed code now adds ModalWindow's markup first into the HTML page and then replaces its content *directly* with the component's markup to show in the modal window (the current implementation does it the other way around).
> The proposed change would require a migration effort for some usages of ModalWindow though. Forms inside a ModalWindow inside another form have to be 'made root forms', either by overriding isRootForm() and getRootForm() or perhaps we could introduce a new interface (e.g. IFormSeparator) which signals to a form that its containment in another form doesn't make it a nested form.
> Note that this issue is not about esthetics only, we have reocurring usecases in our projects (a form inside a modal window inside another *multipart* form) which require quirks to make it work. I can provide more information on this if required.
> Further note that even standard form submits are now possible on ModalWindows too (might be interesting for multipart uploads directly initiated from a ModalWindow's form).

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (WICKET-3404) Improve ModalWindow form handling

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

Sven Meier updated WICKET-3404:
-------------------------------

    Attachment: ModalWindow.patch

Proposed patch.

> Improve ModalWindow form handling
> ---------------------------------
>
>                 Key: WICKET-3404
>                 URL: https://issues.apache.org/jira/browse/WICKET-3404
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket-extensions
>    Affects Versions: 1.5-RC1
>            Reporter: Sven Meier
>         Attachments: ModalWindow.patch
>
>
> Currently ModalWindow's javascript generates a generic <form> tag into the page.
> This is done to support nested forms while preventing temporary invalid HTML markup in the browser, i.e. a form nested in a another form.
> IMHO this is rather inelegant, which manifests itself in the following note in ModalWindow's javadoc:
> "If you want to use form in modal window component make sure that you put the modal window itself in another form (nesting forms is legal in Wicket) ..."
> I'm always having a hard time to explain this sentence to Wicket newcomers.
> My proposal: Let go of the <form> tag in javascript with the attached patch!
> The changed code now adds ModalWindow's markup first into the HTML page and then replaces its content *directly* with the component's markup to show in the modal window (the current implementation does it the other way around).
> The proposed change would require a migration effort for some usages of ModalWindow though. Forms inside a ModalWindow inside another form have to be 'made root forms', either by overriding isRootForm() and getRootForm() or perhaps we could introduce a new interface (e.g. IFormSeparator) which signals to a form that its containment in another form doesn't make it a nested form.
> Note that this issue is not about esthetics only, we have reocurring usecases in our projects (a form inside a modal window inside another *multipart* form) which require quirks to make it work. I can provide more information on this if required.
> Further note that even standard form submits are now possible on ModalWindows too (might be interesting for multipart uploads directly initiated from a ModalWindow's form).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.