Hi,

I'd like to update a TextField in a Form that is connected to a
DatePicker. But somehow this does not work.
My first impression is that DatePicker winns over the setOutputMarkupId
method in setting the id atribute of the TextField.
Could that be true and is it a bug or a feature, esp. is there a way
arround it?

To verify this I adapted the code of the ChoicePage given in the
wicket.examples.

When I run the example and trigger an update event by changing the
content of the "trigger" TextField, the Ajax Debug Window shows the
folowing:

 INFO:
 INFO: initiating ajax POST request with...
 INFO: url:
/wicket-examples/ajax?wicket:interface=:2:form:trigger::IBehaviorListener&wicket:behaviorId=1
 INFO: body: trigger=triggasdferModel&
 INFO: successHandler:function () {
}
 INFO: failureHandler:function () {
}
 INFO: received ajax response. 384 characters, envelope following...
 INFO:
 INFO: <?xml version="1.0" encoding="UTF-8"?><ajax-response><component
id="form_arrival" ><![CDATA[<input value="13.07.06" type="text"
wicket:id="arrival" size="15" name="arrival" id="2:form:arrival">
</input>]]></component><component id="form_text" ><![CDATA[<input
value="textModel" type="text" wicket:id="text" size="15" name="text"
id="form_text">
</input>]]></component></ajax-response>
ERROR: Component with id [[form_arrival]] a was not found while trying
to perform markup update. Make sure you called
component.setOutputMarkupId(true) on the component whose markup you are
trying to update.
ERROR: error while processing response: TypeError: element has no
properties.element has no properties
 INFO: invoking failure handler...



Markup:
<wicket:extend>

<br/><br/>
<form wicket:id="form">
<input wicket:id="arrival" id="arrival" type="text" size="15">
</input>
<span wicket:id="arrivalPicker"></span>
<input wicket:id="text" id="text" type="text" size="15">
</input>
<input wicket:id="trigger" id="trigger" type="text" size="15">
</input>
<input type="submit">
</form>

</wicket:extend>


Java code:
public class ChoicePage extends BasePage
{
    private Date date = new Date();
    private String textModel = "textModel";
    private String triggerModel = "triggerModel";

    /**
     * Constructor.
     */
    public ChoicePage()
    {
        final TextField arrival = new TextField(
                "arrival", new Model(date), Date.class);
        arrival.setOutputMarkupId(true);

        final TextField text = new TextField(
                "text", new Model(textModel), String.class);
        text.setOutputMarkupId(true);

        final TextField trigger = new TextField(
                "trigger", new Model(triggerModel), String.class);

        Form form = new Form("form");
        add(form);

        form.add(arrival);
        form.add(new DatePicker("arrivalPicker", null, arrival));
        form.add(text);
        form.add(trigger);
       
        trigger
        .add(new AjaxFormComponentUpdatingBehavior("onchange") {
            protected void onUpdate(AjaxRequestTarget target) {
                target.addComponent(arrival);
                target.addComponent(text);
            }
        });

    }
}


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to