Ended up with this:
public class ClearFormComponentWizardStep extends WizardStep {

        public ClearFormComponentWizardStep(String pTitleMessageKey) {
                this(pTitleMessageKey, new Model<String>(""));
        }

        public ClearFormComponentWizardStep(String pTitleMessageKey, IModel<?
extends Serializable> pModel) {
                super(pTitleMessageKey, pModel);
        }

        @Override
        public Component getView(String pId, Component pParent, IWizard 
pWizard) {
                WebMarkupContainer view = (WebMarkupContainer) 
super.getView(pId, pParent,
pWizard);
                if(isTimeToClear()) {
                        clearAllFormComponent(view);
                }
                return view;
        }

        /**
         * Can be overriden for changing the clearAllForm behavior
         * 
         * @param pView
         */
        protected void clearAllFormComponent(WebMarkupContainer pView) {
                pView.visitChildren(FormComponent.class, new
Component.IVisitor<FormComponent&lt;?>>() {
                        @Override
                        public Object component(FormComponent<?> 
pFormComponent) {
                                pFormComponent.clearInput();
                                return Component.IVisitor.CONTINUE_TRAVERSAL;
                        }
                });
        }

        /**
         * Override this if any other parameter would affect
clearAllFormComponentCode
         * 
         * @return
         */
        protected boolean isTimeToClear() {
                return true;
        }

}

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wizard-clear-all-formfields-tp4634057p4641106.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

Reply via email to