Hi,

'Ajax POST stopped because of precondition check' is probably your
problem.  all wicket ajax can have a precondition, which is basically
a function that returns true or false, and will only execute the ajax
if it returns true.  I expect that for some reason in your case this
function is returning false.

for an AjaxButton (well AjaxFormSubmitBehavior) the precondition is
this: "return Wicket.$$(this)&&Wicket.$$('" + getForm().getMarkupId()
+ "')";

in the wicket ajax javascript file i see this:

// returns if the element belongs to current document
// if the argument is not element, function returns true
Wicket.$$ = function(element) { 
.......
}

This must be failing for you, which I presume has something to do with
how you are passing the content into the qtip;

content: $('#" + contentMarkupId + "').html()

Hope that helps.

-- 
Regards - Richard Wilkinson
Developer,
jWeekend: OO & Java Technologies - Development and Training
http://jWeekend.com


On 9 March 2010 13:05, Antoine van Wel <antoine.van....@gmail.com> wrote:
> Hi everybody,
>
> Integrating a Jquery tooltip (qtip) went smoothly until I tried to do
> an Ajax form submit.
> The Wicket Ajax Debug panel shows an "Ajax POST stopped because of
> precondition check", so an Ajax response is never sent.
>
> What I'm doing is simply render the text for the tooltip on the same
> page in a hidden div, then pointing the content of the tooltip to that
> div.
>
> the html:
>
> <wicket:head>
>        <script type="text/javascript" src="/js/jquery-1.3.2.min.js"></script>
>        <script type="text/javascript" 
> src="/js/jquery.qtip-1.0.0-rc3.min.js"></script>
> </wicket:head>
>
> <wicket:extend>
>        <div wicket:id="content" style="display: none;">
>                <form wicket:id="form">
>                        <input type="submit" wicket:id="clickme" value="click 
> me">
>                </form>
>        </div>
>
>        <span wicket:id="tipme">hover over me</span>
> </wicket:extend>
>
> the page class:
>
> public class JQueryTestPage extends BasePage {
>        public JQueryTestPage() {
>                WebMarkupContainer content = new WebMarkupContainer("content");
>                add(content);
>
>                Form<Void> form = new Form<Void>("form");
>                content.add(form);
>                form.add(new AjaxButton("clickme") {
>                       �...@override
>                        protected void onSubmit(AjaxRequestTarget target, 
> Form<?> form) {
>                                System.out.println("testing");
>                        }
>
>                });
>
>                WebMarkupContainer qtip = new WebMarkupContainer("tipme");
>                add(qtip);
>                qtip.add(new QTipBehavior(qtip, content));
>        }
>
> }
>
>
> and finally the QTipBehavior:
>
> public class QTipBehavior extends AbstractBehavior {
>        private String componentMarkupId;
>        private String contentMarkupId;
>
>        public QTipBehavior(Component parent, Component content) {
>                contentMarkupId = content.getMarkupId();
>                componentMarkupId = parent.getMarkupId();
>        }
>
>       �...@override
>        public void renderHead(IHeaderResponse response) {
>                String javascript = new StringBuilder()
>                        .append("$(function() {")
>                        .append("       $('#" + componentMarkupId + 
> "').qtip({")
>                        .append("               content: $('#" + 
> contentMarkupId + "').html(),")
>                        .append("               hide: { fixed: true },")
>                        .append("               position: { corner: { target: 
> 'topRight', tooltip:
> 'leftTop' } },")
>                        .append("       })")
>                        .append("});")
>                        .toString();
>                response.renderOnDomReadyJavascript(javascript);
>        }
> }
>
>
> All pretty straightforward.
>
> So my guess is somehow Wicket is not happy about the redirection I
> created by not using the rendered button directly.
> I've been trying to debug this using Firebug, obviously without success.
>
> Does anybody have any hints how to solve this? Is the approach I'm
> taking flawed? Maybe jWicket or wiQuery could help here?
>
>
>
> Antoine
>
> ---------------------------------------------------------------------
> 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