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

Reply via email to