Re: How to veto textfield inputChanged()?

2012-10-11 Thread Francois Meillet

you can use that yourFormComponent.setEnabled( false );

François

Le 11 oct. 2012 à 14:55, l yeung lenming.ye...@gmail.com a écrit :

 Hi,
 
 How do I veto textfield inputChanged()?
 I need to prevent this from happening inside
 AjaxFormComponentUpdatingBehavior(onchange).
 
 protected void onUpdate(AjaxRequestTarget target) {
String name = getModelObject().getName();
if (query(name) == null) {
// veto value change for this field.
} else {
// refresh form
}
 }
 
 I would like to prevent any value change propagated to my domain object
 while inside ajax onchange.
 
 Thanks in advance.
 
 Cheers


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



Re: How to veto textfield inputChanged()?

2012-10-11 Thread Sven Meier
Overwrite getUpdateModel() to return false.

Sven

l yeung lenming.ye...@gmail.com schrieb:

Hi,

How do I veto textfield inputChanged()?
I need to prevent this from happening inside
AjaxFormComponentUpdatingBehavior(onchange).

protected void onUpdate(AjaxRequestTarget target) {
String name = getModelObject().getName();
if (query(name) == null) {
// veto value change for this field.
} else {
// refresh form
}
}

I would like to prevent any value change propagated to my domain object
while inside ajax onchange.

Thanks in advance.

Cheers


Re: How to veto textfield inputChanged()?

2012-10-11 Thread Martijn Dashorst
Why not create a validator that does your check? You can use the
converted input prior to the model update and if. The validation
reports an error, the model is not updated

On 11 okt. 2012, at 18:48, Sven Meier s...@meiers.net wrote:

 Overwrite getUpdateModel() to return false.

 Sven

 l yeung lenming.ye...@gmail.com schrieb:

 Hi,

 How do I veto textfield inputChanged()?
 I need to prevent this from happening inside
 AjaxFormComponentUpdatingBehavior(onchange).

 protected void onUpdate(AjaxRequestTarget target) {
   String name = getModelObject().getName();
   if (query(name) == null) {
   // veto value change for this field.
   } else {
   // refresh form
   }
 }

 I would like to prevent any value change propagated to my domain object
 while inside ajax onchange.

 Thanks in advance.

 Cheers
 B‹CB•È[œÝXœØÜšX™KK[XZ[ˆ\Ù\œË][œÝXœØÜšX™PÚXÚÙ]˜\XÚK›Ü™ÃB‘›ÜˆY][Û˜[ÛÛ[X[™ËK[XZ[ˆ\Ù\œËZ[ÚXÚÙ]˜\XÚK›Ü™ÃBƒ

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