Hello,

we are using Wicket 1.4.18 and we found a problem if we open two pages then the AjaxLink works great but the AjaxSubmitLink doesn't. The page is mounted by HybridUrlCodingStrategy, but I've tried the normal bookmarkable mount and the behavior is the same. I've created a simple page, that demonstrates the problem.

public class TestPage extends WebPage {

    private String input;

    public TestPage() {
        Form<Void> form;
        add(form = new Form<Void>("form"));

final TextField<String> inputField = new TextField<String>("input", new PropertyModel<String>(this, "input"));
        form.add(inputField.setOutputMarkupId(true));

        form.add(new AjaxSubmitLink("submit") {

            @Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
                input = "submit " + Math.random();
                target.addComponent(inputField);
            }
        });
        form.add(new AjaxLink<Void>("link") {

            @Override
            public void onClick(AjaxRequestTarget target) {
                input = "link " + Math.random();
                target.addComponent(inputField);
            }
        });
    }

    public String getInput() {
        return input;
    }

    public void setInput(String input) {
        this.input = input;
    }
}

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";> <html xmlns="http://www.w3.org/1999/xhtml"; xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd";>
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>TestPage</title>
</head>
<body>
    <form wicket:id="form">
        <div>
            <input wicket:id="input"/>
            <a wicket:id="submit">submit</a>
            <a wicket:id="link">link</a>
        </div>
    </form>
</body>
</html>

Just open the page in two tabs in one browser (I've tested it in Opera and Chrome). In the first tab click to the submit link (AjaxSubmitLink) and then switch to the second page and click to the submit link too. Nothing happened. I investigated there is used EmptyAjaxRequestTarget, but I'm not sure why, because if try the same scenario using the second link (AjaxLink) then it works fine.

Where is the problem? What am I doing wrong? How can I solve this problem?

Best regards,
Jan

Reply via email to