Re: AjaxFormComponentUpdatingBehavior is not called when the textfield is set as required field.

2010-06-22 Thread Steve Mactaggart
The form will be validated first, and if there is no information entered the
Required validation will fail and so the form will not be updated.

Wicket ensures that the model object is always consistent by ensuring that
the components are Validated before their value is pushed into the model.

In this case if you do type something in the field and move out of it you
should see the println statement.  But if there is no text in there the
Required validation will stop the model from updating.

The AjaxFormComponentUpdatingBehavior aims to update the model it is
attached to, and so will only fire if the validation occurs.

You could override onError() in this case if you still wanted to be
notified.
protected void onError(AjaxRequestTarget target, RuntimeException e) {
}


On Tue, Jun 22, 2010 at 11:13 AM, jammyjohn jchinnas...@yahoo.com wrote:


 Hi,

  If the setRequired is  set to true, then the println statement is not
 called, otherwise it is called.
 Not sure, where I am doing wrong. Please suggest.

 final TextFieldString name= new TextFieldString(name);

name.setRequired(true);


 form.add(name.setConvertEmptyInputStringToNull(false).setOutputMarkupId(true));

  name.add(new AjaxFormComponentUpdatingBehavior(onBlur){
@Override
protected void onUpdate(AjaxRequestTarget target) {

System.out.println(is this called?);
target.addComponent(feedbackPanel);
}

});

 Thanks for your time.
 J.
 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/AjaxFormComponentUpdatingBehavior-is-not-called-when-the-textfield-is-set-as-required-field-tp2263486p2263486.html
 Sent from the Wicket - User mailing list archive at Nabble.com.

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




Re: AjaxFormComponentUpdatingBehavior is not called when the textfield is set as required field.

2010-06-22 Thread jammyjohn

Thanks for your input. It was very useful.

J.
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/AjaxFormComponentUpdatingBehavior-is-not-called-when-the-textfield-is-set-as-required-field-tp2263486p2264933.html
Sent from the Wicket - User mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org