Unless I misunderstand, this would erase the entire form, rather than 
reset the form fields to their original values. ???




From:   Martin Grigorov <mgrigo...@apache.org>
To:     users@wicket.apache.org
Date:   11/22/2011 01:15 AM
Subject:        Re: Can't Reset Form After DropDownChoice OnChange Handled



On Mon, Nov 21, 2011 at 11:30 PM, Richard W. Adams <rwada...@up.com> 
wrote:
> I've been doing a lot of Googling on this topic & found this page, which
> seems to describe exactly the problem I'm having:
>
> http://www.jaxtut.com/Navigation.jsp
>
> It suggests calling resetFromSession(), though it doesn't give an
> implementation & this method doesn't seem to be part of Wicket.
>
> Has anyone found a way to reset the form after the model has changed & 
the
> form re-rendered thru Ajax? If there isn't a way to do this in Wicket, 
is
> there a "Wicket wish list" to add it to?

All you need is an AjaxButton with .setDefaultFormProcessing(false)
and in its onClick(AjaxRequestTarget target) to do:
getForm().setModelObject(new MyEntity());
target.add(getForm());

i.e. set a new empty model object for the form and all its form 
components.

>
>
>
> From:   Igor Vaynberg <igor.vaynb...@gmail.com>
> To:     users@wicket.apache.org
> Date:   11/21/2011 02:18 PM
> Subject:        Re: Can't Reset Form After DropDownChoice OnChange 
Handled
>
>
>
> I don't think the browser reset button supports ajax..
>
> -igor
> On Nov 21, 2011 5:08 AM, "Richard W. Adams" <rwada...@up.com> wrote:
>
>> The form just has a standard HTML reset button:
>>
>> <input wicket:id="reset-button"  type="reset"  value="Reset"  />
>>
>> There's no special code associated with the button. Should there be? I
>> looked at "Wicket in Action," but it doesn't seem to address this 
issue.
>>
>> "RAM /abr./: Rarely Adequate Memory."
>>
>>
>>
>> From:   Igor Vaynberg <igor.vaynb...@gmail.com>
>> To:     users@wicket.apache.org
>> Date:   11/17/2011 03:42 PM
>> Subject:        Re: Can't Reset Form After DropDownChoice OnChange
> Handled
>>
>>
>>
>> what does your reset code look like?
>>
>> -igor
>>
>> On Thu, Nov 17, 2011 at 9:00 AM, aksarben <rwada...@up.com> wrote:
>> > I have a drop down choice component, and when the selection changes, 
I
>> udpate
>> > various form fields by Ajax, in the form as follows:
>> >
>> > *public HistoryDropDown(final String id, final Map<K, ?> map, final
>> > Component dateField, final
>> >        TrackDetailModel model, final TrackAttribute attribute) {
>> >
>> >        super(id, map);
>> >        final String originalValue = 
model.getOriginalValue(attribute);
>> >        add(new AjaxFormComponentUpdatingBehavior("onchange") {
>> >                private static final long serialVersionUID = -1;
>> >                @Override
>> >                protected void onUpdate(final AjaxRequestTarget 
target)
> {
>>              // When
>> > selection changes
>> >
>> >                        final String newValue =
>> model.getAttributeValue(attribute);     // What the
>> > new choice?
>> >                        if (newValue.equals(originalValue)) {
>>                              // If back to original value
>> >                                dateField.setEnabled(false);
>>                                       // Disable date field
>> >
>>  model.restoreOriginalDateAndUser(attribute);                    //
>> Restore original data
>> >                        } else {
>>                                                               // If
>> changing to new value
>> >                                dateField.setEnabled(true);
>>                                              // Enable date field
>> >                               
 model.setDefaultDateAndUser(attribute);
>>                              // Effective date = today
>> >                        }
>>                                                                      //
>> User = current user
>> >                        target.addComponent(dateField.getParent());
>>                              // Re-render fields
>> >        }
>> >    });
>> > }
>> > *
>> > The updates work fine (the screen re-renders properly), but if I then
>> click
>> > the form's Reset button, nothing happens. I saw some other posts that
>> said I
>> > have to do a form.modelchanged(), but that didn't any effect.
>> >
>> > --
>> > View this message in context:
>>
>>
> 
http://apache-wicket.1842946.n4.nabble.com/Can-t-Reset-Form-After-DropDownChoice-OnChange-Handled-tp4080685p4080685.html

>
>>
>> > Sent from the Users forum mailing list archive at Nabble.com.
>> >
>> > ---------------------------------------------------------------------
>> > 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
>>
>>
>>
>>
>> **
>>
>> This email and any attachments may contain information that is
>> confidential and/or privileged for the sole use of the intended
> recipient.
>>  Any use, review, disclosure, copying, distribution or reliance by
> others,
>> and any forwarding of this email or its contents, without the express
>> permission of the sender is strictly prohibited by law.  If you are not
> the
>> intended recipient, please contact the sender immediately, delete the
>> e-mail and destroy all copies.
>> **
>>
>
>
>
> **
>
> This email and any attachments may contain information that is 
confidential and/or privileged for the sole use of the intended recipient. 
 Any use, review, disclosure, copying, distribution or reliance by others, 
and any forwarding of this email or its contents, without the express 
permission of the sender is strictly prohibited by law.  If you are not 
the intended recipient, please contact the sender immediately, delete the 
e-mail and destroy all copies.
> **
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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




**

This email and any attachments may contain information that is confidential 
and/or privileged for the sole use of the intended recipient.  Any use, review, 
disclosure, copying, distribution or reliance by others, and any forwarding of 
this email or its contents, without the express permission of the sender is 
strictly prohibited by law.  If you are not the intended recipient, please 
contact the sender immediately, delete the e-mail and destroy all copies.
**

Reply via email to