Yes, you can reset the form quite easily, with or without Ajax. I haven't
read the rest of the thread, but if you just reset the object that the form
is referencing all the fields would stay in sync and be 'reset'.

-Clint

On Mon, Nov 21, 2011 at 3:30 PM, Richard W. Adams <[email protected]> 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?
>
>
>
> From:   Igor Vaynberg <[email protected]>
> To:     [email protected]
> 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" <[email protected]> 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 <[email protected]>
> > To:     [email protected]
> > 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 <[email protected]> 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: [email protected]
> > > For additional commands, e-mail: [email protected]
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [email protected]
> > For additional commands, e-mail: [email protected]
> >
> >
> >
> >
> > **
> >
> > 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.
> **
>

Reply via email to