Re: reset form

2021-06-29 Thread Bas Gooren
Hi,

To remove any user input in form fields, you also need to call
Form#clearInput() (or FormComponent#clearInput() to clear specific
components).

Without this call, the fields will retain the user input instead of showing
the empty string you set (assuming that the fields you set to an empty
string value are used as model values for the form components).

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 29 juni 2021 bij 10:22:01, vahid ghasemi (vahidghasemi...@gmail.com)
schreef:

First, thanks for the speed of your support.

1 AjaxButton reset = new AjaxButton("reset") {

2 @Override

3 public void onSubmit(AjaxRequestTarget target) {

4 name = nationalCode = email = phone = password =
confirmPassword = "";

5 target.add(form);

6 }

7 };
8 reset.setDefaultFormProcessing(false);

#setDefaultFormProcessing is working and breakpoint goes in line 4. but
after running code my inputs are still filled with values that have been
inside.

‫‪Sven Meier‬‏ <‪s...@meiers.net‬‏> در تاریخ سه‌شنبه ۲۹ ژوئن ۲۰۲۱ ساعت
۱۲:۲۶ نوشت:‬

> Hi,
>
> you have to call #setDefaultFormProcessing(false).
>
> Have fun
> Sven
>
>
> On 29.06.21 09:46, vahid ghasemi wrote:
> > Hello guys.
> > I have a form that has two buttons (Submit, Reset) and my form is
> > CompoundPropertiesModel.
> > The type of these buttons are AjaxButtons.
> > but Reset only works when the form is valid, otherwise it goes into the
> > onError method.
> > The type of reset button tag is "reset" and also the submit button is
> > "submit".
> > Before submitting the form (and without the wicket ajax button for
reset
> > button) the reset button is working. But after submitting when I click
on
> > the reset button (still without the wicket ajax button) my inputs don't
> go
> > empty.
> > So i think my problem was for CompoundPropertiesModel and i should set
> > empty fields of class and i need to add a wicket button to reset button
> > that reset inputs.
> > But the reset buttons it's not working because he thinks it is a submit
> > button.
> > So my questions are:
> > 1- How can i add some button link reset button for working when form is
> not
> > valid.
> > 2- What is the best way to reset the form with a button?
> > 3- why the reset button (just with type="reset") is not working after
> > submitting form?
> >
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: reset form

2021-06-29 Thread Maxim Solodovnik
you have to add the fields to the target

On Tue, 29 Jun 2021 at 15:22, vahid ghasemi 
wrote:

> First, thanks for the speed of your support.
>
>1 AjaxButton reset = new AjaxButton("reset") {
>
>2 @Override
>
>3public void onSubmit(AjaxRequestTarget target) {
>
>4 name = nationalCode = email = phone = password =
> confirmPassword = "";
>
>5  target.add(form);
>
>6 }
>
>7 };
>8 reset.setDefaultFormProcessing(false);
>
> #setDefaultFormProcessing is working and breakpoint goes in line 4. but
> after running code my inputs are still filled with values that have been
> inside.
>
> ‫‪Sven Meier‬‏ <‪s...@meiers.net‬‏> در تاریخ سه‌شنبه ۲۹ ژوئن ۲۰۲۱ ساعت
> ۱۲:۲۶ نوشت:‬
>
> > Hi,
> >
> > you have to call #setDefaultFormProcessing(false).
> >
> > Have fun
> > Sven
> >
> >
> > On 29.06.21 09:46, vahid ghasemi wrote:
> > > Hello guys.
> > > I have a form that has two buttons (Submit, Reset) and my form is
> > > CompoundPropertiesModel.
> > > The type of these buttons are AjaxButtons.
> > > but Reset only works when the form is valid, otherwise it goes into the
> > > onError method.
> > > The type of reset button tag is "reset" and also the submit button is
> > > "submit".
> > > Before submitting the form (and without the wicket ajax button for
> reset
> > > button) the reset button is working. But after submitting when I click
> on
> > > the reset button (still without the wicket ajax button) my inputs don't
> > go
> > > empty.
> > > So i think my problem was for CompoundPropertiesModel and i should set
> > > empty fields of class and i need to add a wicket button to reset button
> > > that reset inputs.
> > > But the reset buttons it's not working because he thinks it is a submit
> > > button.
> > > So my questions are:
> > > 1- How can i add some button link reset button for working when form is
> > not
> > > valid.
> > > 2- What is the best way to reset the form with a button?
> > > 3- why the reset button (just with type="reset") is not working after
> > > submitting form?
> > >
> >
> > -
> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > For additional commands, e-mail: users-h...@wicket.apache.org
> >
> >
>


-- 
Best regards,
Maxim


Re: reset form

2021-06-29 Thread vahid ghasemi
First, thanks for the speed of your support.

   1 AjaxButton reset = new AjaxButton("reset") {

   2 @Override

   3public void onSubmit(AjaxRequestTarget target) {

   4 name = nationalCode = email = phone = password =
confirmPassword = "";

   5  target.add(form);

   6 }

   7 };
   8 reset.setDefaultFormProcessing(false);

#setDefaultFormProcessing is working and breakpoint goes in line 4. but
after running code my inputs are still filled with values that have been
inside.

‫‪Sven Meier‬‏ <‪s...@meiers.net‬‏> در تاریخ سه‌شنبه ۲۹ ژوئن ۲۰۲۱ ساعت
۱۲:۲۶ نوشت:‬

> Hi,
>
> you have to call #setDefaultFormProcessing(false).
>
> Have fun
> Sven
>
>
> On 29.06.21 09:46, vahid ghasemi wrote:
> > Hello guys.
> > I have a form that has two buttons (Submit, Reset) and my form is
> > CompoundPropertiesModel.
> > The type of these buttons are AjaxButtons.
> > but Reset only works when the form is valid, otherwise it goes into the
> > onError method.
> > The type of reset button tag is "reset" and also the submit button is
> > "submit".
> > Before submitting the form (and without the wicket ajax button for reset
> > button) the reset button is working. But after submitting when I click on
> > the reset button (still without the wicket ajax button) my inputs don't
> go
> > empty.
> > So i think my problem was for CompoundPropertiesModel and i should set
> > empty fields of class and i need to add a wicket button to reset button
> > that reset inputs.
> > But the reset buttons it's not working because he thinks it is a submit
> > button.
> > So my questions are:
> > 1- How can i add some button link reset button for working when form is
> not
> > valid.
> > 2- What is the best way to reset the form with a button?
> > 3- why the reset button (just with type="reset") is not working after
> > submitting form?
> >
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: reset form

2021-06-29 Thread Sven Meier

Hi,

you have to call #setDefaultFormProcessing(false).

Have fun
Sven


On 29.06.21 09:46, vahid ghasemi wrote:

Hello guys.
I have a form that has two buttons (Submit, Reset) and my form is
CompoundPropertiesModel.
The type of these buttons are AjaxButtons.
but Reset only works when the form is valid, otherwise it goes into the
onError method.
The type of reset button tag is "reset" and also the submit button is
"submit".
Before submitting the form (and without the wicket ajax button for reset
button) the reset button is working. But after submitting when I click on
the reset button (still without the wicket ajax button) my inputs don't go
empty.
So i think my problem was for CompoundPropertiesModel and i should set
empty fields of class and i need to add a wicket button to reset button
that reset inputs.
But the reset buttons it's not working because he thinks it is a submit
button.
So my questions are:
1- How can i add some button link reset button for working when form is not
valid.
2- What is the best way to reset the form with a button?
3- why the reset button (just with type="reset") is not working after
submitting form?



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