Hi there!

 

I've been giving a Try to Wicket framework. But I have to admit that I'm
starting to get crazy! Some help appreciated.

 

I'm using last Wicket distribution 1.4.11

 

And I'm trying to implement the Wicket Form (with ajax) example you can
find here:
http://wicketstuff.org/wicket14/nested/?wicket:bookmarkablePage=:org.apa
che.wicket.examples.ajax.builtin.FormPage 

 

It just doesn't work for Firefox (chrome behaves correctly). The Ajax is
ignored and a normal submit is perform (actually, it does the ajax
first, it fails and then it does the normal submit). I have no way to
check what is going on, because the server logs nothing and the Ajax
debug layer is cleaned after the pages reloads.

 

 

I'm copying the example here for your convenience:

 

FormPanel.java

-------------------------

 

ublic class FormPanel extends WebPage {

    private final Bean bean = new Bean();

 

    /**

     * Constructor

     */

    public FormPanel() {

        // create feedback panel to show errors

        final FeedbackPanel feedback = new FeedbackPanel("feedback");

        feedback.setOutputMarkupId(true);

        add(feedback);

 

        // add form with markup id setter so it can be updated via ajax

        Form<Bean> form = new Form<Bean>("form", new
CompoundPropertyModel<Bean>(bean));

        add(form);

        form.setOutputMarkupId(true);

 

        FormComponent fc;

 

        // add form components to the form as usual

 

        fc = new RequiredTextField<String>("name");

        fc.add(StringValidator.minimumLength(4));

 

        form.add(fc);

 

        fc = new RequiredTextField<String>("email");

        fc.add(EmailAddressValidator.getInstance());

 

        form.add(fc);

 

        // attach an ajax validation behavior to all form component's
onkeydown

        // event and throttle it down to once per second

 

        AjaxFormValidatingBehavior.addToAllFormComponents(form,
"onkeyup", Duration.ONE_SECOND);

 

        // add a button that can be used to submit the form via ajax

        form.add(new AjaxButton("ajax-button", form) {

            @Override

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

                // repaint the feedback panel so that it is hidden

                target.addComponent(feedback);

            }

 

            @Override

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

                // repaint the feedback panel so errors are shown

                target.addComponent(feedback);

            }

        });

    }

 

    /**

     * simple java bean.

     */

    public static class Bean implements IClusterable {

        private String name, email;

 

        /**

         * Gets email.

         *

         * @return email

         */

        public String getEmail() {

            return email;

        }

 

        /**

         * Sets email.

         *

         * @param email email

         */

        public void setEmail(String email) {

            this.email = email;

        }

 

        /**

         * Gets name.

         *

         * @return name

         */

        public String getName() {

            return name;

        }

 

        /**

         * Sets name.

         *

         * @param name name

         */

        public void setName(String name) {

            this.name = name;

        }

    }

}

 

 

 

 

FormPanel.html

-----------------------

 

 

<?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:wicket="http://wicket.apache.org";>

<head>

    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>

    <title>event test</title>

</head>

<body>

<br/>

Start typing in the textfields and see the form being validated as you
type. Ajax requests are throttled down to once per second, so they will
not

overload the server.

<br/>

 

<div wicket:id="feedback">[[ feedback ]]</div>

 

<form wicket:id="form">

    <input type="text" wicket:id="name"/>

    <input type="text" wicket:id="email"/>

    <br/>

    <br/>

    <input type="submit" value="submit via ajax"
wicket:id="ajax-button"/>

    <input type="submit" value="submit"/>

</form>

</body>

</html>

 

 

 

Could please anyone check?

 

Thank you.

 

 

 

 

 


==== The EFG Mail Gateway made the following annotation ====

This message is for the addressee only and may contain confidential or
privileged information. You must delete and not use it if you are not
the intended recipient. It may not be secure or error-free. All e-mail
communications to and from the EFG Financial Products Group may be monitored.
Processing of incoming e-mails cannot be guaranteed. Any views expressed
in this message are those of the individual sender. This message is for
information purposes only. All liability of the EFG Financial Products Group
and its entities for any damages resulting from e-mail use is excluded.
US persons are kindly requested to read the important legal information
presented at following URL: http://www.efgfp.com. If you suspect that the
message may have been intercepted or amended, please call the sender.
Should you require any further information, please contact the Compliance
Manager on complia...@efgfp.com.
============================================================

Reply via email to