You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by jammyjohn <jc...@yahoo.com> on 2010/06/22 03:13:04 UTC

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

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 TextField<String> name= new TextField<String>("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-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


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

Posted by jammyjohn <jc...@yahoo.com>.
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-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


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

Posted by Steve Mactaggart <st...@whitesquaresoft.com>.
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 <jc...@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 TextField<String> name= new TextField<String>("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-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>