StatelessForm.clearInput()

View: New views
5 Messages — Rating Filter:   Alert me  

StatelessForm.clearInput()

by Tomás Rossi :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi.

I have a stateless form and a button inside to reset all fields like this:

...
            add(new Button("clear") {
                private static final long serialVersionUID = 1L;

                public void onSubmit() {
                    getForm().clearInput();
                };
            }.setDefaultFormProcessing(false));
...

The first time I use the form, fill some inputs and then hit "Clear",
the form is submitted and returns from the server clean (which is what I
expected to happen). But after I submit the form with all valid input
(that redirects me to another page with a message), then press browser's
back button (return to the form) and then hit the Clear button, some of
the fields keep they values and some of  them cleans. What is happening?


Thanks,
Tom;

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: StatelessForm.clearInput()

by martin-g :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

What's the benefit of this approach instead of using <input
type="reset"/> without involving Wicket at all (it is stateless form) ?

El vie, 30-10-2009 a las 12:42 -0300, Tomás Rossi escribió:

> Hi.
>
> I have a stateless form and a button inside to reset all fields like this:
>
> ...
>             add(new Button("clear") {
>                 private static final long serialVersionUID = 1L;
>
>                 public void onSubmit() {
>                     getForm().clearInput();
>                 };
>             }.setDefaultFormProcessing(false));
> ...
>
> The first time I use the form, fill some inputs and then hit "Clear",
> the form is submitted and returns from the server clean (which is what I
> expected to happen). But after I submit the form with all valid input
> (that redirects me to another page with a message), then press browser's
> back button (return to the form) and then hit the Clear button, some of
> the fields keep they values and some of  them cleans. What is happening?
>
>
> Thanks,
> Tom;
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: StatelessForm.clearInput()

by Tomás Rossi :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

That's a very good question. I'll use that.

But then, if it weren't a stateless form, should I involve Wicket and
use clearInput()? Why?

Tom;

Martin Grigorov escribió:

> What's the benefit of this approach instead of using <input
> type="reset"/> without involving Wicket at all (it is stateless form) ?
>
> El vie, 30-10-2009 a las 12:42 -0300, Tomás Rossi escribió:
>  
>> Hi.
>>
>> I have a stateless form and a button inside to reset all fields like this:
>>
>> ...
>>             add(new Button("clear") {
>>                 private static final long serialVersionUID = 1L;
>>
>>                 public void onSubmit() {
>>                     getForm().clearInput();
>>                 };
>>             }.setDefaultFormProcessing(false));
>> ...
>>
>> The first time I use the form, fill some inputs and then hit "Clear",
>> the form is submitted and returns from the server clean (which is what I
>> expected to happen). But after I submit the form with all valid input
>> (that redirects me to another page with a message), then press browser's
>> back button (return to the form) and then hit the Clear button, some of
>> the fields keep they values and some of  them cleans. What is happening?
>>
>>
>> Thanks,
>> Tom;
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@...
>> For additional commands, e-mail: users-help@...
>>
>>
>>    
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...
>
>
>  


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: StatelessForm.clearInput()

by Tomás Rossi :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Wait a minute... Because I need a reset button which effectively clean
all fields and feedback messages. Reset button doesn't do that so it's
not what I want.

Tomás Rossi escribió:

> That's a very good question. I'll use that.
>
> But then, if it weren't a stateless form, should I involve Wicket and
> use clearInput()? Why?
>
> Tom;
>
> Martin Grigorov escribió:
>> What's the benefit of this approach instead of using <input
>> type="reset"/> without involving Wicket at all (it is stateless form) ?
>>
>> El vie, 30-10-2009 a las 12:42 -0300, Tomás Rossi escribió:
>>  
>>> Hi.
>>>
>>> I have a stateless form and a button inside to reset all fields like
>>> this:
>>>
>>> ...
>>>             add(new Button("clear") {
>>>                 private static final long serialVersionUID = 1L;
>>>
>>>                 public void onSubmit() {
>>>                     getForm().clearInput();
>>>                 };
>>>             }.setDefaultFormProcessing(false));
>>> ...
>>>
>>> The first time I use the form, fill some inputs and then hit
>>> "Clear", the form is submitted and returns from the server clean
>>> (which is what I expected to happen). But after I submit the form
>>> with all valid input (that redirects me to another page with a
>>> message), then press browser's back button (return to the form) and
>>> then hit the Clear button, some of the fields keep they values and
>>> some of  them cleans. What is happening?
>>>
>>>
>>> Thanks,
>>> Tom;
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@...
>>> For additional commands, e-mail: users-help@...
>>>
>>>
>>>    
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@...
>> For additional commands, e-mail: users-help@...
>>
>>
>>  
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: StatelessForm.clearInput()

by Tomás Rossi :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ok, I did it. I needed to clean the model object like this...

...
            add(new Button("clear") {
                private static final long serialVersionUID = 1L;

                public void onSubmit() {
                    getForm().modelChanging();
                    data.clear(); // data is the model object of the
form, and clear sets null to all fields, recursively
                    getForm().modelChanged();
                    getForm().clearInput();
                };
            }.setDefaultFormProcessing(false));
...

Tomás Rossi escribió:

> Wait a minute... Because I need a reset button which effectively clean
> all fields and feedback messages. Reset button doesn't do that so it's
> not what I want.
>
> Tomás Rossi escribió:
>> That's a very good question. I'll use that.
>>
>> But then, if it weren't a stateless form, should I involve Wicket and
>> use clearInput()? Why?
>>
>> Tom;
>>
>> Martin Grigorov escribió:
>>> What's the benefit of this approach instead of using <input
>>> type="reset"/> without involving Wicket at all (it is stateless form) ?
>>>
>>> El vie, 30-10-2009 a las 12:42 -0300, Tomás Rossi escribió:
>>>  
>>>> Hi.
>>>>
>>>> I have a stateless form and a button inside to reset all fields
>>>> like this:
>>>>
>>>> ...
>>>>             add(new Button("clear") {
>>>>                 private static final long serialVersionUID = 1L;
>>>>
>>>>                 public void onSubmit() {
>>>>                     getForm().clearInput();
>>>>                 };
>>>>             }.setDefaultFormProcessing(false));
>>>> ...
>>>>
>>>> The first time I use the form, fill some inputs and then hit
>>>> "Clear", the form is submitted and returns from the server clean
>>>> (which is what I expected to happen). But after I submit the form
>>>> with all valid input (that redirects me to another page with a
>>>> message), then press browser's back button (return to the form) and
>>>> then hit the Clear button, some of the fields keep they values and
>>>> some of  them cleans. What is happening?
>>>>
>>>>
>>>> Thanks,
>>>> Tom;
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@...
>>>> For additional commands, e-mail: users-help@...
>>>>
>>>>
>>>>    
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@...
>>> For additional commands, e-mail: users-help@...
>>>
>>>
>>>  
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@...
>> For additional commands, e-mail: users-help@...
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...