Not sure what you mean, exactly. The only alternative I can see it to keep an "original" copy of the form model (assuming there IS a single) model, then add an onclick handler() to the reset button, then go back to the server, overwrite the current model with the original model, then add the form component to the AjaxRequestTarget so it's re-rendered. This could be ugly & error prone real fast, especially if all of the form fields weren't covered by a single model. \
Am I missing something here? From: Clint Checketts <checke...@gmail.com> To: users@wicket.apache.org Date: 11/21/2011 03:37 PM Subject: Re: Can't Reset Form After DropDownChoice OnChange Handled 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 <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? > > > > 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. > ** > ** 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. **