[ 
https://issues.apache.org/jira/browse/WICKET-1815?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Igor Vaynberg resolved WICKET-1815.
-----------------------------------

      Assignee: Igor Vaynberg  (was: Matej Knopp)
    Resolution: Fixed

> Problem rendering not visible Form with OutputMarkupPlaceholderTag
> ------------------------------------------------------------------
>
>                 Key: WICKET-1815
>                 URL: https://issues.apache.org/jira/browse/WICKET-1815
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.3
>         Environment: Nothing special, i guess.
>            Reporter: German Morales
>            Assignee: Igor Vaynberg
>            Priority: Minor
>
> Hi all,
> We had suffered an strange behavior, which i would like to share for comments.
> We have a Panel (loaded with ajax) with many Forms inside (because each needs 
> different models).
> Some of these Forms are only visible under certain conditions, so we 
> overwrote isVisible with the condition.
> Also, the Panel can be updated, so the Forms have 
> setOutputMarkupPlaceholderTag(true) to make them visible later.
> That triggered a problem in the rendering of the ajax response.
> After some investigation, the problem seems to be:
> -When a Form is visible, Form#onComponentTag replaces the tag "form" by "div" 
> (because it's nor the Root form of the page), this works ok.
> -When a Form is invisible, Form#onComponentTag is never called. Instead, 
> Component#render builds the response by itself, using 
> markupStream.getTag().getName(), which answers the tag "form".
> -Then, the ajax response has a mix of "div" and "form". Apparently, all goes 
> ok until the first "form" is found, then the parsing goes somehow crazy and 
> this first "form" gets lost from the DOM, and the next forms and divs get 
> inserted outside (one level in DOM) the main component being replaced by the 
> ajax call.
> We have found no way to fix it in the Form class itself. Component uses 
> markupStream.getTag() (which answers "form"). That is, it does not ask the 
> component for the tag to answer, but instead trusts in the HTML side. And we 
> can't change our html to say "div", because Form also checks (when visible) 
> that the tag says "form" (checkComponentTag(tag, "form")).
> The solution was to put the missbehaving forms inside Panels, which do not 
> suffer this problem, and then make the panels visible/invisible (also with 
> OutputMarkupPlaceholderTag).
> We have it running now, but we wanted to know if there was some better 
> solution, or perpahs something should be fixed to prevent future problems, 
> for example:
> -inform somehow if a form is being set as invisible with 
> setOutputMarkupPlaceholderTag(true)?
> -let Component ask itself for the tag to output in case of invisible + 
> setOutputMarkupPlaceholderTag(true), instead of just putting what the markup 
> says... then Form could say "no, i want a div here".
> -other?
> Thanks in advance,
> German

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

Reply via email to