No problem ... I have to thank you, you pointed me in the right direction.
Finding such DOM problems while the Browser renders them just fine and even 
calling JQuery selector on console returns the element can be pain in the ass 
...

Marvin Richter


-----Original Message-----
From: Martin Grigorov [mailto:mgrigo...@apache.org] 
Sent: Thursday, February 06, 2014 3:40 PM
To: users@wicket.apache.org
Subject: Re: Precondition Check

So the check fails here
https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js?source=c#L511
the form is not there ...

Thanks for sharing!

Martin Grigorov
Wicket Training and Consulting


On Thu, Feb 6, 2014 at 3:35 PM, Richter, Marvin < 
marvin.rich...@jestadigital.com> wrote:

> Ok, that would be a valid scenario where that makes sense but that's 
> not the case.
>
> But I found the problem:
> Because of the the childing of my panels the one that was not working 
> was inside a <form> tag but this panel also contains a form.
>
> As of the HTML specification it is not allowed to nest forms ...
>
> Chrome and FF are so failure tolerant that while rendering they just 
> ignore it. But the Submit will not work anymore ...
>
> Marvin Richter
> Software Developer
> T  +49 (0) 30 69 538 1099
> M  +49 (0) 174 744 4991
> marvin.rich...@jestadigital.com
>
> JESTA DIGITAL GmbH   Karl-Liebknecht-Str. 32   10178 Berlin, Germany
> Gesellschaft mit beschränkter Haftung mit Sitz in Berlin HRB Nr. 97990 
> Amtsgericht Charlottenburg
> Geschäftsführer: Markus Peuler
>
>
> -----Original Message-----
> From: Martin Grigorov [mailto:mgrigo...@apache.org]
> Sent: Thursday, February 06, 2014 3:22 PM
> To: users@wicket.apache.org
> Subject: Re: Precondition Check
>
> you can click on it and the event listener can delay the actual Ajax 
> call as much as it wants (Wicket's AjaxChannel.QUEUE does exactly this).
>
> E.g. click two times on the link, the first click fires Ajax call (the 
> second click waits), its response removes the link from the DOM (or 
> replaces it), then the second click event will be prevented because 
> its event.target is no more in the DOM
>
>
> Martin Grigorov
> Wicket Training and Consulting
>
>
> On Thu, Feb 6, 2014 at 3:13 PM, Richter, Marvin < 
> marvin.rich...@jestadigital.com> wrote:
>
> > That is the point I don't get ... how can an element doesn't exist 
> > in DOM but I can click on it?
> >
> > Marvin Richter
> >
> >
> > -----Original Message-----
> > From: Martin Grigorov [mailto:mgrigo...@apache.org]
> > Sent: Thursday, February 06, 2014 3:05 PM
> > To: users@wicket.apache.org
> > Subject: Re: Precondition Check
> >
> > Hi,
> >
> > I see you don't have custom AjaxRequestAttributes, so no custom 
> > preconditions.
> > Wicket has just one default precondition - it will execute the Ajax 
> > call only if the related HTML element (the link) is in the current
> document.
> >
> >
> > https://github.com/apache/wicket/blob/master/wicket-core/src/main/ja
> > va
> > /org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js?source=c#L508
> >
> > Put a breakpoint in Dev Tools/Firebug and see why the link is not in 
> > the document.
> >
> > Martin Grigorov
> > Wicket Training and Consulting
> >
> >
> > On Thu, Feb 6, 2014 at 2:50 PM, Richter, Marvin < 
> > marvin.rich...@jestadigital.com> wrote:
> >
> > > Args ... I already had this problem some time ago but I can't 
> > > remember what it was exactly.
> > >
> > > Wicket Ajax Debug:
> > > INFO: Ajax request stopped because of precondition check, url:
> > > ./admin?1-5.IBehaviorListener.1-configTypes-panel-dialog-footer-bu
> > > tt
> > > on
> > > s-0-button
> > >
> > > I have two different Panels with almost the same functionality ...
> > > creating a new Object and persist it. One is working fine but the 
> > > other one not.
> > >
> > > Works:
> > > private Component save(final Form<ConfigType> form) {
> > >         return new AjaxSubmitLink(BUTTON_MARKUP_ID, form) {
> > >
> > >                     @Override
> > >                     protected void onSubmit(AjaxRequestTarget 
> > > target, Form<?> f) {
> > >                         Logger log = 
> > > LoggerFactory.getLogger(EditConfigTypeDialog.class);
> > >                         ConfigManager cm = 
> > > EjbSupportImpl.getInstance().getConfigManager();
> > >                         ConfigType configType = form.getModelObject();
> > >                         if (configType.getId() != null) {
> > >                             try {
> > >                                 ConfigType updated = 
> > > cm.updateConfigType(configType);
> > >                                 form.success("Successfully updated 
> > > the ConfigType.");
> > >                                 form.setModelObject(updated);
> > >                             } catch (CcaException ex) {
> > >                                 form.error("Failed to update
> > ConfigType");
> > >                                 log.error("Failed to update 
> > > ConfigType", ex);
> > >                             }
> > >                         } else {
> > >                             try {
> > >                                 ConfigType created = 
> > > cm.addConfigType(configType);
> > >                                 form.success("Successfully created 
> > > the ConfigType.");
> > >                                 form.setModelObject(created);
> > >                             } catch (CcaException ex) {
> > >                                 form.error("Failed to create
> > ConfigType");
> > >                                 log.error("Failed to create 
> > > ConfigType", ex);
> > >                             }
> > >                         }
> > >                         target.add(form);
> > >                     }
> > >
> > >                     @Override
> > >                     protected void onError(AjaxRequestTarget 
> > > target, Form<?> form) {
> > >                         target.add(form);
> > >                     }
> > >
> > >                     @Override
> > >                     public void onComponentTagBody(MarkupStream 
> > > markupStream, ComponentTag openTag) {
> > >                         replaceComponentTagBody(markupStream,
> > > openTag, "Save");
> > >                     }
> > >                 }.add(new ButtonBehavior(Buttons.Type.Primary));
> > >     }
> > >
> > > Doesn't work:
> > > private Component save(final Form<ConfigKey> form) {
> > >         return new AjaxSubmitLink(BUTTON_MARKUP_ID, form) {
> > >
> > >                     @Override
> > >                     protected void onSubmit(AjaxRequestTarget 
> > > target, Form<?> f) {
> > >                         Logger log = 
> > > LoggerFactory.getLogger(EditConfigKeyDialog.class);
> > >                         ConfigManager cm = 
> > > EjbSupportImpl.getInstance().getConfigManager();
> > >                         ConfigKey configKey = form.getModelObject();
> > >                         if (configKey.getId() != null) {
> > >                             try {
> > >                                 ConfigKey updated = 
> > > cm.updateConfigKey(configKey);
> > >                                 form.success("Successfully updated 
> > > the ConfigKey");
> > >                                 form.setModelObject(updated);
> > >                             } catch (CcaException ex) {
> > >                                 form.error("Failed to update
> ConfigKey");
> > >                                 log.error("Failed to update 
> > > ConfigKey", ex);
> > >                             }
> > >                         } else {
> > >                             try {
> > >                                 ConfigKey created = 
> > > cm.addConfigKey(configKey);
> > >                                 form.success("Successfully created 
> > > the ConfigKey");
> > >                                 form.setModelObject(created);
> > >                             } catch (CcaException ex) {
> > >                                 form.error("Failed to create
> ConfigKey");
> > >                                 log.error("Failed to create 
> > > ConfigKey", ex);
> > >                             }
> > >                         }
> > >                         target.add(form);
> > >                     }
> > >
> > >                     @Override
> > >                     protected void onError(AjaxRequestTarget 
> > > target, Form<?> form) {
> > >                         target.add(form);
> > >                     }
> > >
> > >                     @Override
> > >                     public void onComponentTagBody(MarkupStream 
> > > markupStream, ComponentTag openTag) {
> > >                         replaceComponentTagBody(markupStream,
> > > openTag, "Save");
> > >                     }
> > >                 }.add(new ButtonBehavior(Buttons.Type.Primary));
> > >     }
> > >
> > > I don't see a big difference why the other wouldn't work. You?
> > >
> > >
> > > Marvin Richter
> > > Software Developer
> > > T  +49 (0) 30 69 538 1099
> > > M  +49 (0) 174 744 4991
> > > marvin.rich...@jestadigital.com<mailto:marvin.richter@jestadigital
> > > .c
> > > om
> > > >
> > >
> > > JESTA DIGITAL GmbH   Karl-Liebknecht-Str. 32   10178 Berlin, Germany
> > > Gesellschaft mit beschränkter Haftung mit Sitz in Berlin HRB Nr.
> > > 97990 Amtsgericht Charlottenburg
> > > Geschäftsführer: Markus Peuler
> > >
> > >
> >
>

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

Reply via email to