Re: Fields in modal window not resetting
Hi, ModalWindow is an Ajax component, so it makes the page stateful. That means Wicket will render the page with its current state. When submitting the Form the request parameters are used to feed the form components (the input fields). The submitted data is stored in FormComponent's model. To reset the form you should null-ify both the FormComponents' input and model, i.e. Form.clearInput() + formComponent.setModelObject(null), or whatever is appropriate instead of null as default/initial value. Martin Grigorov Freelancer. Available for hire! Wicket Training and Consulting https://twitter.com/mtgrigorov On Tue, Jul 7, 2015 at 4:50 PM, Lois GreeneHernandez lgreenehernan...@knoa.com wrote: Hi All, I have a modal window with two fields and a confirm and cancel button. The fields do not reset after submitting and the data from the previous use is still there. I have tried several things. 1) Refreshing the form on submit 2) form.clearInput(); (also on submit) 3) trying to set the input fields on construction of the form Nothing is working. Any advice is appreciated. I'm posting my code below. Thanks in advance for your help. public abstract class NewMappingRulePanel extends Panel { private static final long serialVersionUID = 1L; private static final Logger log = LoggerFactory.getLogger(NewMappingRulePanel.class); private final ListDictModelBean dictModelBeans; private DictModelBean dictModelBean; public NewMappingRulePanel( final String id, DictModelBean dictModelBean, final Class? extends ConsolePage backPage, ListDictModelBean dictModelBeans ) { super(id, new ModelDictModelBean()); this.dictModelBean = dictModelBean; this.dictModelBeans = dictModelBeans; KnoaFormVoid form = new KnoaForm(form); add(form); final KnoaFeedbackPanel feedbackPanel = new KnoaFeedbackPanel(feedbackPanel); form.add(feedbackPanel); form.TextFieldString, StringaddTextField( starPattern, new PropertyModelString(dictModelBean, starPattern), 25, dictionary.mapping.dictentry.starpattern.label ).setRequired(true); form.add(new Label(dictLabel, ResourceKeyHelper.resourceValue(dictionary.mapping.dictentry.label))); final Select2ChoicePanel select2ChoicePanel = new Select2ChoicePanel(dictionaryEntry, new PropertyModelString(dictModelBean, dictionaryEntry), new DictTextChoiceProvider(dictModelBeans)); form.add(select2ChoicePanel); AjaxFallbackButton button = new AjaxFallbackButton(confirm, new ResourceModel(confirm.label), form) { private static final long serialVersionUID = 1L; ConfirmMessagePanel confirmMessagePanel; @Override protected void onSubmit(AjaxRequestTarget target, Form? form) { NewMappingRulePanel.this.refreshPage(target); findParent(ModalWindow.class).close(target); KnoaPage.refreshComp(target,form); } @Override protected void onError(AjaxRequestTarget target, Form? form) { KnoaPage.refreshComp(target, feedbackPanel); } }; //button.add(new AttributeModifier(onclick, setDirty(true);));//warn on exit button.setOutputMarkupId(true); form.add(button); button = new AjaxFallbackButton(cancel, new ResourceModel(cancel.label), form) { private static final long serialVersionUID = 1L; @Override protected void onSubmit(AjaxRequestTarget target, Form? form) { if (target != null) { (findParent(ModalWindow.class)).close(target); } } @Override protected void onError(AjaxRequestTarget target, Form? form) { onSubmit(target, form); } }; button.setDefaultFormProcessing(false); form.add(button); } public DictModelBean getDictModelBean() { return dictModelBean; } public void setDictModelBean(DictModelBean dictModelBean) { this.dictModelBean = dictModelBean; } public abstract void refreshPage(AjaxRequestTarget target); }
Re: 6.0.x Docs Down?
The link for 6.0 api still down. http://ci.apache.org/projects/wicket/apidocs/6.x/ Where would I found the API document? Thanks and best regards, Gump On Tue, Jun 30, 2015 at 1:54 PM, Martin Grigorov mgrigo...@apache.org wrote: https://blogs.apache.org/infra/entry/buildbot_master_currently_off_line On Jun 30, 2015 6:00 AM, kyabe_JP okabe.wic...@gmail.com wrote: I have failed to access to any apidocs page, e.g http://ci.apache.org/projects/wicket/apidocs/6.x/ http://ci.apache.org/projects/wicket/apidocs/6.x/ . According to the past conversation, the BuildBot servers had been back. Am I looking wrong address or if it down again ? -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/6-0-x-Docs-Down-tp4665501p4671417.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
Fields in modal window not resetting
Hi All, I have a modal window with two fields and a confirm and cancel button. The fields do not reset after submitting and the data from the previous use is still there. I have tried several things. 1) Refreshing the form on submit 2) form.clearInput(); (also on submit) 3) trying to set the input fields on construction of the form Nothing is working. Any advice is appreciated. I'm posting my code below. Thanks in advance for your help. public abstract class NewMappingRulePanel extends Panel { private static final long serialVersionUID = 1L; private static final Logger log = LoggerFactory.getLogger(NewMappingRulePanel.class); private final ListDictModelBean dictModelBeans; private DictModelBean dictModelBean; public NewMappingRulePanel( final String id, DictModelBean dictModelBean, final Class? extends ConsolePage backPage, ListDictModelBean dictModelBeans ) { super(id, new ModelDictModelBean()); this.dictModelBean = dictModelBean; this.dictModelBeans = dictModelBeans; KnoaFormVoid form = new KnoaForm(form); add(form); final KnoaFeedbackPanel feedbackPanel = new KnoaFeedbackPanel(feedbackPanel); form.add(feedbackPanel); form.TextFieldString, StringaddTextField( starPattern, new PropertyModelString(dictModelBean, starPattern), 25, dictionary.mapping.dictentry.starpattern.label ).setRequired(true); form.add(new Label(dictLabel, ResourceKeyHelper.resourceValue(dictionary.mapping.dictentry.label))); final Select2ChoicePanel select2ChoicePanel = new Select2ChoicePanel(dictionaryEntry, new PropertyModelString(dictModelBean, dictionaryEntry), new DictTextChoiceProvider(dictModelBeans)); form.add(select2ChoicePanel); AjaxFallbackButton button = new AjaxFallbackButton(confirm, new ResourceModel(confirm.label), form) { private static final long serialVersionUID = 1L; ConfirmMessagePanel confirmMessagePanel; @Override protected void onSubmit(AjaxRequestTarget target, Form? form) { NewMappingRulePanel.this.refreshPage(target); findParent(ModalWindow.class).close(target); KnoaPage.refreshComp(target,form); } @Override protected void onError(AjaxRequestTarget target, Form? form) { KnoaPage.refreshComp(target, feedbackPanel); } }; //button.add(new AttributeModifier(onclick, setDirty(true);));//warn on exit button.setOutputMarkupId(true); form.add(button); button = new AjaxFallbackButton(cancel, new ResourceModel(cancel.label), form) { private static final long serialVersionUID = 1L; @Override protected void onSubmit(AjaxRequestTarget target, Form? form) { if (target != null) { (findParent(ModalWindow.class)).close(target); } } @Override protected void onError(AjaxRequestTarget target, Form? form) { onSubmit(target, form); } }; button.setDefaultFormProcessing(false); form.add(button); } public DictModelBean getDictModelBean() { return dictModelBean; } public void setDictModelBean(DictModelBean dictModelBean) { this.dictModelBean = dictModelBean; } public abstract void refreshPage(AjaxRequestTarget target); }
Re: 6.0.x Docs Down?
If you happen to use maven your favorite IDE, for sure, will allow you to download and peruse it at your leisure :-) On Wed, Jul 8, 2015 at 3:39 AM, gump lee zeno@gmail.com wrote: The link for 6.0 api still down. http://ci.apache.org/projects/wicket/apidocs/6.x/ Where would I found the API document? Thanks and best regards, Gump On Tue, Jun 30, 2015 at 1:54 PM, Martin Grigorov mgrigo...@apache.org wrote: https://blogs.apache.org/infra/entry/buildbot_master_currently_off_line On Jun 30, 2015 6:00 AM, kyabe_JP okabe.wic...@gmail.com wrote: I have failed to access to any apidocs page, e.g http://ci.apache.org/projects/wicket/apidocs/6.x/ http://ci.apache.org/projects/wicket/apidocs/6.x/ . According to the past conversation, the BuildBot servers had been back. Am I looking wrong address or if it down again ? -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/6-0-x-Docs-Down-tp4665501p4671417.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 -- Regards - Ernesto Reinaldo Barreiro
Re: Fields in modal window not resetting
As your formComponents are bind to dictModelBean with a PropertyModel, you must reset the object in your model with something like : dictModelBean.setObject(new DictBean()); -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Fields-in-modal-window-not-resetting-tp4671524p4671532.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