Oups, Integer.class should be on the number field, not the name field :) 
Doesn't really matter though, it still blows up :)

-- Edvin

Edvin Syse skrev:
I created a standard quickstart project and added this to HomePage.java:

public class HomePage extends WebPage {
    private ModelObject o = new ModelObject();
public HomePage(final PageParameters parameters) {
        add(new FeedbackPanel("feedback"));
        Form f = new Form("f", new CompoundPropertyModel(o));
        add(f);
final TextField name = new TextField("name", Integer.class);
        name.setRequired(true);
        name.setOutputMarkupId(true);
        f.add(name);
final TextField number = new TextField("number");
        number.add(new AjaxFormComponentUpdatingBehavior("onblur") {
            @Override protected void onUpdate(AjaxRequestTarget target) {
                o.setName("Number " + number.getConvertedInput());
                target.addComponent(name);
            }
        });
        f.add(number);
f.add(new Button("submit"));
    }

    class ModelObject implements Serializable {
        private Integer number;
        private String name;
public Integer getNumber() {
            return number;
        }
        public void setNumber(Integer number) {
            this.number = number;
        }
        public String getName() {
            return name;
        }
        public void setName(String name) {
            this.name = name;
        }
    }
}

And the HomePage.html:

<html xmlns:wicket="http://wicket.apache.org";>
    <body>
        <div wicket:id="feedback">Feedback</div>
<form wicket:id="f">
            <fieldset>
                <p>
                    <label>Number</label>
                    <input type="text" wicket:id="number" />
                </p>
<p>
                    <label>Name</label>
                    <input type="text" wicket:id="name" />
                </p>
            </fieldset>
<input type="submit" wicket:id="submit" /> </form>
    </body>
</html>


If you add a number and press tab, the name input will display "Name <number>". Works good until you try to submit once without a value in the name input, and get the validation message "Field 'name' is required.".

After that, name will not be updated if you tab out of number.

-- Edvin


Igor Vaynberg skrev:
create a testcase please

-igor


On Jan 4, 2008 11:52 AM, Edvin Syse <[EMAIL PROTECTED]> wrote:
Hi!

I have a form which uses a CompoundPropertyModel.

On the form I have a textfield which has a AjaxFormComponentUpdatingBehavior connected to the onblur event. When I have some data in the field and tab out of the field, the onblur event will update some other parts of the modelobject and add their respective components
(textfields) to the ajax target.

This works good until I once submit the form and get one or more validation errors. After that, the changed data that occur in the onblur event doesn't get pushed back with the ajax target. (They just display their former data even though the model object was updated).

Can anyone think of what causes this, or should I create a testcase?

Sincerely,
Edvin Syse

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to