You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Anna Simbirtsev <as...@gmail.com> on 2010/02/25 17:43:08 UTC

wicket:enclosure does not get re-rendered

Hi,

I have fragment inside wicket:enclosure. When ajax submit takes place, it
tries to re-render fragment, but does not succeed, since wicket:enclosure is
still invisible, even though isVisible method returns true.



<div class="largeinput-required">
        <h2>Password</h2>
        <input wicket:id="password" type="text" />
</div>
<div class="submitarea"><a wicket:id="submit" href="#"
class="button">SUBMIT</a></div>

<wicket:enclosure child="fragment">
   <span wicket:id="fragment">fragments contents come here</span>
   <wicket:fragment wicket:id="fragmentid">
....

   </wicket:fragment>
</wicket:enclosure>




boolean authenticated=false;
final Model<String> m = new Model<String>();
form.add(new RequiredTextField<String>("password", m));

AjaxSubmitLink submitbutton = new AjaxSubmitLink("submit") {

            private static final long serialVersionUID = 1L;

            protected void onSubmit(AjaxRequestTarget target, Form<?> form)
{

                authenticated = true;

                target.addComponent(f);
            }
};
form.add(submitbutton);

f = new Fragment("fragment", "fragmentid", form) {

            private static final long serialVersionUID =
2612235776527846442L;

            public boolean isVisible() {
                  if (authenticated)
                       return true;

                  return false;
            }
};
 f.setOutputMarkupId(true);
 form.add(f);


Thanks
Anna

Re: wicket:enclosure does not get re-rendered

Posted by Anna Simbirtsev <as...@gmail.com>.
Thanks, its working now.

On Thu, Feb 25, 2010 at 12:02 PM, Igor Vaynberg <ig...@gmail.com>wrote:

> enclosures are a shortcut/convenience and do nto work for all
> scenarios. whenever the enclosure does not work you can use
> EnclosureContainer or simply a WebMarkupContainer.
>
> to repaint something via ajax that is initially invisible you need to
> call setoutputmarkupplacehodlertag(true) on it.
>
> -igor
>
> On Thu, Feb 25, 2010 at 8:43 AM, Anna Simbirtsev <as...@gmail.com>
> wrote:
> > Hi,
> >
> > I have fragment inside wicket:enclosure. When ajax submit takes place, it
> > tries to re-render fragment, but does not succeed, since wicket:enclosure
> is
> > still invisible, even though isVisible method returns true.
> >
> >
> >
> > <div class="largeinput-required">
> >        <h2>Password</h2>
> >        <input wicket:id="password" type="text" />
> > </div>
> > <div class="submitarea"><a wicket:id="submit" href="#"
> > class="button">SUBMIT</a></div>
> >
> > <wicket:enclosure child="fragment">
> >   <span wicket:id="fragment">fragments contents come here</span>
> >   <wicket:fragment wicket:id="fragmentid">
> > ....
> >
> >   </wicket:fragment>
> > </wicket:enclosure>
> >
> >
> >
> >
> > boolean authenticated=false;
> > final Model<String> m = new Model<String>();
> > form.add(new RequiredTextField<String>("password", m));
> >
> > AjaxSubmitLink submitbutton = new AjaxSubmitLink("submit") {
> >
> >            private static final long serialVersionUID = 1L;
> >
> >            protected void onSubmit(AjaxRequestTarget target, Form<?>
> form)
> > {
> >
> >                authenticated = true;
> >
> >                target.addComponent(f);
> >            }
> > };
> > form.add(submitbutton);
> >
> > f = new Fragment("fragment", "fragmentid", form) {
> >
> >            private static final long serialVersionUID =
> > 2612235776527846442L;
> >
> >            public boolean isVisible() {
> >                  if (authenticated)
> >                       return true;
> >
> >                  return false;
> >            }
> > };
> >  f.setOutputMarkupId(true);
> >  form.add(f);
> >
> >
> > Thanks
> > Anna
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Anna Simbirtsev
(416) 729-7331

Re: wicket:enclosure does not get re-rendered

Posted by Igor Vaynberg <ig...@gmail.com>.
enclosures are a shortcut/convenience and do nto work for all
scenarios. whenever the enclosure does not work you can use
EnclosureContainer or simply a WebMarkupContainer.

to repaint something via ajax that is initially invisible you need to
call setoutputmarkupplacehodlertag(true) on it.

-igor

On Thu, Feb 25, 2010 at 8:43 AM, Anna Simbirtsev <as...@gmail.com> wrote:
> Hi,
>
> I have fragment inside wicket:enclosure. When ajax submit takes place, it
> tries to re-render fragment, but does not succeed, since wicket:enclosure is
> still invisible, even though isVisible method returns true.
>
>
>
> <div class="largeinput-required">
>        <h2>Password</h2>
>        <input wicket:id="password" type="text" />
> </div>
> <div class="submitarea"><a wicket:id="submit" href="#"
> class="button">SUBMIT</a></div>
>
> <wicket:enclosure child="fragment">
>   <span wicket:id="fragment">fragments contents come here</span>
>   <wicket:fragment wicket:id="fragmentid">
> ....
>
>   </wicket:fragment>
> </wicket:enclosure>
>
>
>
>
> boolean authenticated=false;
> final Model<String> m = new Model<String>();
> form.add(new RequiredTextField<String>("password", m));
>
> AjaxSubmitLink submitbutton = new AjaxSubmitLink("submit") {
>
>            private static final long serialVersionUID = 1L;
>
>            protected void onSubmit(AjaxRequestTarget target, Form<?> form)
> {
>
>                authenticated = true;
>
>                target.addComponent(f);
>            }
> };
> form.add(submitbutton);
>
> f = new Fragment("fragment", "fragmentid", form) {
>
>            private static final long serialVersionUID =
> 2612235776527846442L;
>
>            public boolean isVisible() {
>                  if (authenticated)
>                       return true;
>
>                  return false;
>            }
> };
>  f.setOutputMarkupId(true);
>  form.add(f);
>
>
> Thanks
> Anna
>

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