Hi,

Thanks!
This is much better now!

On Fri, Mar 7, 2014 at 10:20 AM, chathuraka.waas
<chathuraka.w...@gmail.com>wrote:

> Hi Martin,
>
> Thanks for your guidance on how to post a question.
>
> My scenario is like this.
>
> i'm having a webpage where i have a panel inside it and then inside the
> panel i have a form where i'm placing a fragment conditionally.
>
> This the code for adding the panel to the page.
>
> <div id="MenuFirstPanel" wicket:id="MenuFirstPanel" ></div>
>
> This is the code for adding the fragment.
>
> <wicket:panel>
>     <form wicket:id="form">
>         <div wicket:id="MenuPanel"></div>
>             <wicket:fragment  wicket:id="testFragment">
>

The fragment is a child of a component with wicket:id "MenuPanel".


>                 <div class="clear"></div>
>                 <div>
> sample test
> </div>
>                 <p class="welcome">test message: 244326.</p>
>                 <br/>
>                 <div style="margin-top: 10px;">Your name is: </div>
>             </wicket:fragment>
>     </form>
> </wicket:panel>
>
> this is how i add the fragment in my corresponding panel.java class.
>
> Fragment testFrag  = new Fragment("MenuPanel","testFragment", this);
>

The problem is that the fragment markup container is 'this' (the third
argument), where 'this' is MenuFirstPanel.java
It must be the enclosing parent of the <wicket:fragment>, i.e. the form.

Fragment testFrag  = new Fragment("MenuPanel","testFragment", form);


>               testFrag.add(new Label("shortcode", "11111");
>               add(testFrag);
>
>
> when i do this the following exception is thrown:
>
> org.apache.wicket.markup.MarkupNotFoundException: No Markup found for
> Fragment 'testFragment' in providing markup container [MenuFirstPanel
> [Component id = MenuFirstPanel]]
>         at
>
> org.apache.wicket.markup.html.panel.FragmentMarkupSourcingStrategy.getMarkup(FragmentMarkupSourcingStrategy.java:145)
>         at
> org.apache.wicket.MarkupContainer.getMarkup(MarkupContainer.java:451)
>         at org.apache.wicket.Component.getMarkup(Component.java:743)
>         at org.apache.wicket.Component.getMarkupTag(Component.java:1389)
>         at
> org.apache.wicket.Component.getMarkupIdFromMarkup(Component.java:752)
>         at org.apache.wicket.Component.getMarkupIdImpl(Component.java:1446)
>         at org.apache.wicket.Component.getMarkupId(Component.java:1474)
>
>
> I tried moving the fragment code outside the form element and it works fine
> without an issue.  can any one shed some light on this issue. Thanks in
> advance.
>
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Cannot-place-a-fragment-inside-a-form-element-tp4664841p4664843.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

Reply via email to