Re: How to clear a TextField input?

2010-07-01 Thread David Chang
igor, thank you for the tip. that works.

best.


--- On Thu, 7/1/10, Igor Vaynberg  wrote:

> From: Igor Vaynberg 
> Subject: Re: How to clear a TextField input?
> To: users@wicket.apache.org
> Date: Thursday, July 1, 2010, 6:32 PM
> set the model object to null as
> well.
> 
> -igor
> 
> On Thu, Jul 1, 2010 at 3:25 PM, David Chang 
> wrote:
> > I have a form where it has two elements: AjaxCheckbox
> and TextField. When the checkbox is un-checked, the
> TextField in browser should look blank. Here is the code I
> have:
> >
> > final TextField input = new TextField("myinput") {
> > void onBeforeRender() {
> > super.onBeforeRender();
> > if ("certain way to get model and check is myproperty
> and if it is not true")
> > this.clearInput();
> > }
> > }
> > };
> > AjaxCheckBox box = new AjaxCheckBox("mycheckbox",
> > new PropertyModel(model, "myproperty")) {
> > @Override
> > protected void onUpdate(AjaxRequestTarget target) {
> > if (target != null) {
> > target.addComponent(input);
> > }
> > }
> > };
> >
> > However, when I uncheck the checkbox,
> this.clearInput() in TextField is called, but the in the
> browser, the text field value in the browser is always
> there.
> >
> > Spent sometime and unable to find a way to solve this
> issue. In javascript, this task is so easy. I must have
> missed something.
> >
> > Can somebody show me how to clear the TextField value
> in the browser?
> >
> > Thanks!
> >
> >
> >
> >
> >
> -
> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > For additional commands, e-mail: users-h...@wicket.apache.org
> >
> >
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 
> 


  

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



Re: How to clear a TextField input?

2010-07-01 Thread Igor Vaynberg
set the model object to null as well.

-igor

On Thu, Jul 1, 2010 at 3:25 PM, David Chang  wrote:
> I have a form where it has two elements: AjaxCheckbox and TextField. When the 
> checkbox is un-checked, the TextField in browser should look blank. Here is 
> the code I have:
>
> final TextField input = new TextField("myinput") {
> void onBeforeRender() {
> super.onBeforeRender();
> if ("certain way to get model and check is myproperty and if it is not true")
> this.clearInput();
> }
> }
> };
> AjaxCheckBox box = new AjaxCheckBox("mycheckbox",
> new PropertyModel(model, "myproperty")) {
> @Override
> protected void onUpdate(AjaxRequestTarget target) {
> if (target != null) {
> target.addComponent(input);
> }
> }
> };
>
> However, when I uncheck the checkbox, this.clearInput() in TextField is 
> called, but the in the browser, the text field value in the browser is always 
> there.
>
> Spent sometime and unable to find a way to solve this issue. In javascript, 
> this task is so easy. I must have missed something.
>
> Can somebody show me how to clear the TextField value in the browser?
>
> Thanks!
>
>
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

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



How to clear a TextField input?

2010-07-01 Thread David Chang
I have a form where it has two elements: AjaxCheckbox and TextField. When the 
checkbox is un-checked, the TextField in browser should look blank. Here is the 
code I have:

final TextField input = new TextField("myinput") {
void onBeforeRender() {
super.onBeforeRender();
if ("certain way to get model and check is myproperty and if it is not true")
this.clearInput();
}
}
};
AjaxCheckBox box = new AjaxCheckBox("mycheckbox",
new PropertyModel(model, "myproperty")) {
@Override
protected void onUpdate(AjaxRequestTarget target) {
if (target != null) {
target.addComponent(input);
}
}
};

However, when I uncheck the checkbox, this.clearInput() in TextField is called, 
but the in the browser, the text field value in the browser is always there.

Spent sometime and unable to find a way to solve this issue. In javascript, 
this task is so easy. I must have missed something.

Can somebody show me how to clear the TextField value in the browser?

Thanks!


  

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