You need to add the container to the panel:

add(postDomainContainer);

And you need to add the form to the container instead of the panel
itself:

postDomainContainer.add(commentForm);

Your component hierarchy must match the tag hierarchy.

Hope this helps
Carl-Eric
www.wicketbuch.de



On Sun, 20 May 2012 03:40:51 -0700 (PDT)
kshitiz <k.agarw...@gmail.com> wrote:

> Hi,
> 
> I am trying to cover a form in a container. 
> 
> *SubmitCommentPanel:*
> <wicket:panel>
> *             <div wicket:id="submitCommentPostDomainContainer">*
>                               <form
> wicket:id="commentForm"> </form>
>               </div>
>       </wicket:panel>
> 
> The java code is :
> 
> public SubmitCommentPanel(String id, final ListItem<PostDomain>
> listItem, final UserDomain userDomain) {
>               super(id);
> 
>               // defining container for refreshing list of posts
>               final WebMarkupContainer postDomainContainer = new
> WebMarkupContainer( "submitCommentPostDomainContainer");
>               postDomainContainer.setOutputMarkupId(true);
> 
>               Form<CommentDomain> commentForm = new
> Form<CommentDomain>( "commentForm",
>                               new
> CompoundPropertyModel<CommentDomain>(commentDomain));
> 
> 
>               };
> 
>               
> *             add(commentForm);*
> 
> But the error is:
> 
> *Last cause: Unable to find component with id 'commentForm' in
> [WebMarkupContainer [Component id =
> submitCommentPostDomainContainer]]*
> 
> But if I remove container portion, the code runs fine. Cant I add the
> container. One thing to note that the whole panel is in another
> container:
> 
> 
> <div wicket:id="postDomainListContainer">
>                       
>                               <form wicket:id="postForm">
>                               </form>
> *                             <div
> wicket:id="submitCommentPanel"></div> <br></br>* 
>               </div>
> 
> The above panel though runs fine. What is the issue?
> 
> 
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/wicket-not-able-to-find-component-after-adding-container-componenent-tp4646756.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
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to