Another same probleme with wicket:enclosure tag

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Another same probleme with wicket:enclosure tag

Pierre
Hi,

Need your help ...
                       
                       
 in   MyPage .java  {
       
        //bla bla ...

        private class FormulaireRechercheAgent extends Form<Agent>{

                public FormulaireRechercheAgent(String id) {
                        super(id,new CompoundPropertyModel<Agent>(new Agent()));
                }
        }

       
                         
 final  Label  labelAgentMailpro = new Label("agentMailpro"){
                 
                 @Override
                 protected void onConfigure(){
                        if (agentBySesame==null){
                                this.setVisible(false);
                        }
                }
         };
         
        // another bla bla

         
         final FormulaireRechercheAgent formulaireRechercheAgent = new FormulaireRechercheAgent("formulaireRechercheAgent");
         formulaireRechercheAgent.add(new AjaxButton("btnRecherche", new Model<String>("Rechercher"))
         {

                                        private static final long serialVersionUID = 1L;

                                        @Override
                                        public void onSubmit(AjaxRequestTarget target, Form<?> form)
                                        {
                           
                                                 //selected agent
                                                Agent modelObject = formulaireRechercheAgent.getModelObject();
                                                setAgentBySesame(getLdapAgentsDao().findAgentBySesame(modelObject.getSesame()));
                               
                                                formulaireRechercheAgent.add(labelAgentMailpro);
                                            labelAgentMailpro.setDefaultModelObject(agentBySesame.getEmailPro());
                                         // target.add(labelAgentMailpro);
                                                 target.add(formulaireRechercheAgent.getParent());
                                                  //target.add(formulaireRechercheAgent);
                                       
                                               
                                        }//onsubmit
                                       
                                                @Override
                                protected void onError(AjaxRequestTarget target, Form<?> form)
                                {
                                        //bla bla
                                       
                                }
                               
                               
                                               
        });

}


 MyPage.html

<form wicket:id="formulaireRechercheAgent">


                        <wicket:enclosure child="agentMailpro">
                       
               
	Email : <span wicket:id="agentMailpro"></span>
                        </wicket:enclosure>       

</form>



When I call MyPage then it failed.

Root cause:

org.apache.wicket.WicketRuntimeException: Could not find child with id: agentMailpro in the wicket:enclosure
at org.apache.wicket.markup.html.internal.Enclosure.checkChildComponent(Enclosure.java:250)
at org.apache.wicket.markup.html.internal.Enclosure.getChildComponent(Enclosure.java:228)
at org.apache.wicket.markup.html.internal.Enclosure.onInitialize(Enclosure.java:132)
at org.apache.wicket.Component.fireInitialize(Component.java:864)
at org.apache.wicket.MarkupContainer.internalInitialize(MarkupContainer.java:955)
at org.apache.wicket.MarkupContainer.addedComponent(MarkupContainer.java:932)
at org.apache.wicket.MarkupContainer.add(MarkupContainer.java:174)
at org.apache.wicket.MarkupContainer.autoAdd(MarkupContainer.java:258)
at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1379)
at org.apache.wicket.MarkupContainer.renderAll(MarkupContainer.java:1554)
at org.apache.wicket.MarkupContainer.renderComponentTagBody(MarkupContainer.java:1529)
at org.apache.wicket.MarkupContainer.onComponentTagBody(MarkupContainer.java:1484)
at org.apache.wicket.markup.html.form.Form.onComponentTagBody(Form.java:1683)
at org.apache.wicket.markup.html.panel.DefaultMarkupSourcingStrategy.onComponentTagBody(DefaultMarkupSourcingStrategy.java:71)
at org.apache.wicket.Component.internalRenderComponent(Component.java:2549)
at org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1493)
at org.apache.wicket.Component.internalRender(Component.java:2379)
at org.apache.wicket.Component.render(Component.java:2307)
at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1390)
at org.apache.wicket.MarkupContainer.renderAll(MarkupContainer.java:1554)
at org.apache.wicket.MarkupContainer.renderComponentTagBody(MarkupContainer.java:1529)
at org.apache.wicket.MarkupContainer.onComponentTagBody(MarkupContainer.java:1484)
at org.apache.wicket.markup.html.panel.DefaultMarkupSourcingStrategy.onComponentTagBody(DefaultMarkupSourcingStrategy.java:71)
at org.apache.wicket.Component.internalRenderComponent(Component.java:2549)
at org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1493)
at org.apache.wicket.Component.internalRender(Component.java:2379)
at org.apache.wicket.Component.render(Component.java:2307)
at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1390)
at org.apache.wicket.MarkupContainer.renderAll(MarkupContainer.java:1554)
at org.apache.wicket.MarkupContainer.renderComponentTagBody(MarkupContainer.java:1529)
at org.apache.wicket.MarkupContainer.onComponentTagBody(MarkupContainer.java:1484)
at org.apache.wicket.markup.html.panel.DefaultMarkupSourcingStrategy.onComponentTagBody(DefaultMarkupSourcingStrategy.java:71)
at org.apache.wicket.Component.internalRenderComponent(Component.java:2549)
at org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1493)
at org.apache.wicket.Component.internalRender(Component.java:2379)
at org.apache.wicket.Component.render(Component.java:2307)
at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1390)
at org.apache.wicket.MarkupContainer.renderAll(MarkupContainer.java:1554)
at org.apache.wicket.Page.onRender(Page.java:876)
at org.apache.wicket.markup.html.WebPage.onRender(WebPage.java:142)
at org.apache.wicket.Component.internalRender(Component.java:2379)
at org.apache.wicket.Component.render(Component.java:2307)
at org.apache.wicket.Page.renderPage(Page.java:1010)
at org.apache.wicket.request.handler.render.WebPageRenderer.renderPage(WebPageRenderer.java:121)
at org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:274)
at org.apache.wicket.core.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:165)
at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:861)
at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
at org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:261)
at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:218)
at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:289)
at org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:259)
at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:201)
at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:282)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1332)
at org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:180)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1332)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:477)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:524)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:227)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1031)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:406)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:186)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:965)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:250)
at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:149)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111)
at org.eclipse.jetty.server.Server.handle(Server.java:348)
at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:452)
at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:884)
at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:938)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:630)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:230)
at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:77)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:606)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:46)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:603)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:538)
at java.lang.Thread.run(Thread.java:662)


Any help would be appreciate.
Thanks.


Pierre
Reply | Threaded
Open this post in threaded view
|

Re: Another same probleme with wicket:enclosure tag

Sven Meier
You're adding the label after the submit only

        @Override
        public void onSubmit(AjaxRequestTarget target, Form<?> form)
        {
                ....
                formulaireRechercheAgent.add(labelAgentMailpro);
  }


Sven

On 11/13/2013 11:23 AM, Selom wrote:

> Hi,
>
> Need your help ...
>
>
>   in   MyPage .java  {
>
> //bla bla ...
>
> private class FormulaireRechercheAgent extends Form<Agent>{
>
> public FormulaireRechercheAgent(String id) {
> super(id,new CompoundPropertyModel<Agent>(new Agent()));
> }
> }
>
>
>
>   final  Label  labelAgentMailpro = new Label("agentMailpro"){
>
> @Override
> protected void onConfigure(){
> if (agentBySesame==null){
> this.setVisible(false);
> }
> }
> };
>
> // another bla bla
>
>
> final FormulaireRechercheAgent formulaireRechercheAgent = new
> FormulaireRechercheAgent("formulaireRechercheAgent");
> formulaireRechercheAgent.add(new AjaxButton("btnRecherche", new
> Model<String>("Rechercher"))
> {
>
> private static final long serialVersionUID = 1L;
>
> @Override
> public void onSubmit(AjaxRequestTarget target, Form<?> form)
> {
>                            
> //selected agent
> Agent modelObject = formulaireRechercheAgent.getModelObject();
>
> setAgentBySesame(getLdapAgentsDao().findAgentBySesame(modelObject.getSesame()));
>
> formulaireRechercheAgent.add(labelAgentMailpro);
>
> labelAgentMailpro.setDefaultModelObject(agentBySesame.getEmailPro());
> // target.add(labelAgentMailpro);
> target.add(formulaireRechercheAgent.getParent());
>  //target.add(formulaireRechercheAgent);
>
>
> }//onsubmit
>
> @Override
> protected void onError(AjaxRequestTarget target, Form<?> form)
> {
> //bla bla
>
> }
>
>
>
> });
>
> }
>
>
>   MyPage.html
>
> <form wicket:id="formulaireRechercheAgent">
>
>
> <wicket:enclosure child="agentMailpro">
>
>
> </wicket:enclosure>
>
> </form>
>
>
>
> When I call MyPage then it failed.
>
> Root cause:
>
> org.apache.wicket.WicketRuntimeException: Could not find child with id:
> agentMailpro in the wicket:enclosure
> at
> org.apache.wicket.markup.html.internal.Enclosure.checkChildComponent(Enclosure.java:250)
> at
> org.apache.wicket.markup.html.internal.Enclosure.getChildComponent(Enclosure.java:228)
> at
> org.apache.wicket.markup.html.internal.Enclosure.onInitialize(Enclosure.java:132)
> at org.apache.wicket.Component.fireInitialize(Component.java:864)
> at
> org.apache.wicket.MarkupContainer.internalInitialize(MarkupContainer.java:955)
> at
> org.apache.wicket.MarkupContainer.addedComponent(MarkupContainer.java:932)
> at org.apache.wicket.MarkupContainer.add(MarkupContainer.java:174)
> at org.apache.wicket.MarkupContainer.autoAdd(MarkupContainer.java:258)
> at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1379)
> at org.apache.wicket.MarkupContainer.renderAll(MarkupContainer.java:1554)
> at
> org.apache.wicket.MarkupContainer.renderComponentTagBody(MarkupContainer.java:1529)
> at
> org.apache.wicket.MarkupContainer.onComponentTagBody(MarkupContainer.java:1484)
> at
> org.apache.wicket.markup.html.form.Form.onComponentTagBody(Form.java:1683)
> at
> org.apache.wicket.markup.html.panel.DefaultMarkupSourcingStrategy.onComponentTagBody(DefaultMarkupSourcingStrategy.java:71)
> at org.apache.wicket.Component.internalRenderComponent(Component.java:2549)
> at org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1493)
> at org.apache.wicket.Component.internalRender(Component.java:2379)
> at org.apache.wicket.Component.render(Component.java:2307)
> at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1390)
> at org.apache.wicket.MarkupContainer.renderAll(MarkupContainer.java:1554)
> at
> org.apache.wicket.MarkupContainer.renderComponentTagBody(MarkupContainer.java:1529)
> at
> org.apache.wicket.MarkupContainer.onComponentTagBody(MarkupContainer.java:1484)
> at
> org.apache.wicket.markup.html.panel.DefaultMarkupSourcingStrategy.onComponentTagBody(DefaultMarkupSourcingStrategy.java:71)
> at org.apache.wicket.Component.internalRenderComponent(Component.java:2549)
> at org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1493)
> at org.apache.wicket.Component.internalRender(Component.java:2379)
> at org.apache.wicket.Component.render(Component.java:2307)
> at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1390)
> at org.apache.wicket.MarkupContainer.renderAll(MarkupContainer.java:1554)
> at
> org.apache.wicket.MarkupContainer.renderComponentTagBody(MarkupContainer.java:1529)
> at
> org.apache.wicket.MarkupContainer.onComponentTagBody(MarkupContainer.java:1484)
> at
> org.apache.wicket.markup.html.panel.DefaultMarkupSourcingStrategy.onComponentTagBody(DefaultMarkupSourcingStrategy.java:71)
> at org.apache.wicket.Component.internalRenderComponent(Component.java:2549)
> at org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1493)
> at org.apache.wicket.Component.internalRender(Component.java:2379)
> at org.apache.wicket.Component.render(Component.java:2307)
> at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1390)
> at org.apache.wicket.MarkupContainer.renderAll(MarkupContainer.java:1554)
> at org.apache.wicket.Page.onRender(Page.java:876)
> at org.apache.wicket.markup.html.WebPage.onRender(WebPage.java:142)
> at org.apache.wicket.Component.internalRender(Component.java:2379)
> at org.apache.wicket.Component.render(Component.java:2307)
> at org.apache.wicket.Page.renderPage(Page.java:1010)
> at
> org.apache.wicket.request.handler.render.WebPageRenderer.renderPage(WebPageRenderer.java:121)
> at
> org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:274)
> at
> org.apache.wicket.core.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:165)
> at
> org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:861)
> at
> org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
> at
> org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:261)
> at
> org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:218)
> at
> org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:289)
> at
> org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:259)
> at
> org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:201)
> at
> org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:282)
> at
> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1332)
> at
> org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:180)
> at
> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
> at
> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1332)
> at
> org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:477)
> at
> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
> at
> org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:524)
> at
> org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:227)
> at
> org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1031)
> at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:406)
> at
> org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:186)
> at
> org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:965)
> at
> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
> at
> org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:250)
> at
> org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:149)
> at
> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111)
> at org.eclipse.jetty.server.Server.handle(Server.java:348)
> at
> org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:452)
> at
> org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:884)
> at
> org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:938)
> at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:630)
> at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:230)
> at
> org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:77)
> at
> org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:606)
> at
> org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:46)
> at
> org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:603)
> at
> org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:538)
> at java.lang.Thread.run(Thread.java:662)
>
>
> Any help would be appreciate.
> Thanks.
>
>
>
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Another-same-probleme-with-wicket-enclosure-tag-tp4662371.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Another same probleme with wicket:enclosure tag

Pierre
Hello,
Thanks you for yours  reply.

Of course, I want to show my label if  only if the form  formulaireRechercheAgent is submitted successfully.


I believe the  form is not called yet , since I can not reach the html page.

Sincerly yours.
 


Pierre
Reply | Threaded
Open this post in threaded view
|

Re: Another same probleme with wicket:enclosure tag

Sven Meier
You'll have to add the label beforehand, either keep it invisible before
submit or add a placeholder instead.

Sven

On 11/13/2013 11:48 AM, Selom wrote:

> Hello,
> Thanks you for yours  reply.
>
> Of course, I want to show my label if  only if the form
> formulaireRechercheAgent is submitted successfully.
>
>
> I believe the  form is not called yet , since I can not reach the html page.
>
> Sincerly yours.
>  
>
>
>
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Another-same-probleme-with-wicket-enclosure-tag-tp4662371p4662375.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Another same probleme with wicket:enclosure tag

Pierre
You are right,

adding add(labelAgentMailpro) before    solved  the problem.

Thank you very much.

Pierre
Reply | Threaded
Open this post in threaded view
|

Re: Another same probleme with wicket:enclosure tag

Pierre
Now I replace the label by a form like this

 
         private  FormulaireAgent formulaireAgent = new FormulaireAgent("formulaireAgent", new Agent()){
                 
                 @Override
                 protected void onConfigure(){
                        if (agentBySesame==null){
                                this.setVisible(false);
                        }
                        else {
                                setVisible(true);
                        }
                }
         };
         
         
         
         
              public  class FormulaireAgent extends Form<Agent>{
                            public FormulaireAgent(final String id, Agent agent) {
                                super(id, new CompoundPropertyModel<Agent>(agent));
                                add(new Label("idNomPrenom", agent.getPrenom() + "   " + agent.getNom()));
                                add(new Label("idCorps", agent.getCorps()));
                                add(new Label("idAffectations", agent.getAffectation()));
                                add(new Label("idNaissance", agent.getDateNaisAsString()));
                          add(new Label("idEntreeEtab", agent.getDateEntreeAsString()));
                                add(new Label("idDateConvoc", agent.getDateConvocAsString()));
                                add(new Label("idDateVM", agent.getDateVMasString()));
                               
                        }
       
                        }
                       
                       
                       
                                // Buttons //
                                formulaireRechercheAgent.add(new AjaxButton("btnRecherche", new Model<String>("Rechercher")) {

                                        private static final long serialVersionUID = 1L;

                                        @Override
                                        public void onSubmit(AjaxRequestTarget target, Form<?> form)
                                        {
                                               
                                                //selected agent
                                                    Agent modelObject = formulaireRechercheAgent.getModelObject();
                                                        setAgentBySesame(modelObject);
                                                                formulaireAgent.setDefaultModelObject(getAgentBySesame());
                                                                formulaireAgent.setVisible(true);
                                                                target.add(formulaireAgent);
                                                        target.add(formulaireRechercheAgent.getParent());

                                        }//onsubmit
                                       

A piece od the html file.

                               
       
       
				

       <wicket:enclosure child=formulaireAgent>
			
		<form wicket:id="formulaireAgent">
				<h2>
					<span wicket:id="idNomPrenom"></span>
				</h2>
         <table>
         <tr> <td class="styleLien" ><wicket:message key="agent.corps" /> </td> 
         
         
         <td  wicket:id="idCorps" ></td></tr>
         
         
          //an so on ...
                   
             </table>
				
				
			</form>
			
</wicket:enclosure>


When  formulaireRechercheAgent is submitted, formulaireAgent come with null  value model.  
Do you mind tell me what wrong with this code ?



Pierre
Reply | Threaded
Open this post in threaded view
|

Re: Another same probleme with wicket:enclosure tag[SOLVED]

Pierre
Hi !!

Ok for  closing this topic.

 I created a custom panel.

public PanelAgent(String id, IModel<Agent> agentModel) {
		super(id, agentModel);
		IModel<Agent> compound = new CompoundPropertyModel<Agent>(agentModel);
		Form<Agent> formulaireAgent = new Form<Agent>("formulaireAgent", compound);		
		formulaireAgent.add(new Label("nom"));
		//etc ...
		
		}

and the PanelAgent.html like this.

<wicket:panel>

<form wicket:id="formulaireAgent">
<h2> <span wicket:id="nom"></span></h2>
//And others 
</form>
  </wicket:panel>

               
        //In web Page class
               
                 private  PanelAgent panelInfosAgent = new PanelAgent("panelInfosAgent",new Model<Agent>(Agent.emptyAgent())){
                 @Override
                 protected void onConfigure(){
                        if (agentBySesame==null){
                                this.setVisible(false);
                        }
                        else {
                                setVisible(true);
                        }
                }
         };
         
         Then in the web page html
               
                 <wicket:enclosure child=panelInfosAgent>
                                        <div wicket:id="panelInfosAgent"></div>
                                </wicket:enclosure>                               
                </div>
               
               
                And it works as expected.
                That's a best pratices I think.
                Next time.

               
Selom wrote
When  formulaireRechercheAgent is submitted, formulaireAgent come with null  value model.  
Do you mind tell me what wrong with this code ?
Pierre