Button onSubmit not called, instead page reloads
Have a page that extends another page that in turn extends org.apache.wicket.markup.html.WebPage. Have added a form that extends org.apache.wicket.markup.html.form.Form to this page. In this form, I have a org.apache.wicket.markup.html.form.Button Button searchButton = new Button(searchButton){ @Override public void onSubmit() { super.onSubmit(); System.out.println(in searchButton); SearchPage.this.updateList(); } in the html for the button: input type=submit wicket:id=searchButton value=submit/ but when I click the button, instead of calling the onSubmit(), the page itself is reloaded. Would anyone have any ideas what might be wrong? -- View this message in context: http://www.nabble.com/Button-onSubmit-not-called%2C-instead-page-reloads-tp22350921p22350921.html Sent from the Wicket - User 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
Re: Button onSubmit not called, instead page reloads
the page reloading itself is expected behaviour as the form gets submitted, the onSubmit() method should however be called. if you provided us some more code (and the wicket version you're using)? regards, Michael Edwin Ansicodd wrote: Have a page that extends another page that in turn extends org.apache.wicket.markup.html.WebPage. Have added a form that extends org.apache.wicket.markup.html.form.Form to this page. In this form, I have a org.apache.wicket.markup.html.form.Button Button searchButton = new Button(searchButton){ @Override public void onSubmit() { super.onSubmit(); System.out.println(in searchButton); SearchPage.this.updateList(); } in the html for the button: input type=submit wicket:id=searchButton value=submit/ but when I click the button, instead of calling the onSubmit(), the page itself is reloaded. Would anyone have any ideas what might be wrong? - Michael Sparer http://techblog.molindo.at -- View this message in context: http://www.nabble.com/Button-onSubmit-not-called%2C-instead-page-reloads-tp22350921p22351127.html Sent from the Wicket - User 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
Re: Button onSubmit not called, instead page reloads
I'm using Wicket 1.3.0 Michael Sparer wrote: the page reloading itself is expected behaviour as the form gets submitted, the onSubmit() method should however be called. if you provided us some more code (and the wicket version you're using)? regards, Michael -- View this message in context: http://www.nabble.com/Button-onSubmit-not-called%2C-instead-page-reloads-tp22350921p22351291.html Sent from the Wicket - User 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
Re: Button onSubmit not called, instead page reloads
alright, then show us more code :-) ... and I'd recommend upgrading to 1.3.5 anyway ... Edwin Ansicodd wrote: I'm using Wicket 1.3.0 Michael Sparer wrote: the page reloading itself is expected behaviour as the form gets submitted, the onSubmit() method should however be called. if you provided us some more code (and the wicket version you're using)? regards, Michael - Michael Sparer http://techblog.molindo.at -- View this message in context: http://www.nabble.com/Button-onSubmit-not-called%2C-instead-page-reloads-tp22350921p22351487.html Sent from the Wicket - User 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
Re: Button onSubmit not called, instead page reloads
Some more code: public class SearchPage extends BasePage { private String name = ; public SearchPage(PageParameters parameters) { super(parameters); // TODO Auto-generated constructor stub init(); } private void init() { Form form = new SearchForm(searchForm); getContentContainer().addOrReplace(form); getContentContainer().addOrReplace(new Label(result,).setVisible(false)); } class SearchForm extends Form{ public SearchForm(String id){ super(id); TextField Name = new TextField(search.tf.name, new PropertyModel(SearchPage.this, name)); add(Name); Button searchButton = new Button(searchButton){ @Override public void onSubmit() { super.onSubmit(); System.out.println(in searchButton); SearchPage.this.updateList(); } }; add( searchButton ); } public void onSubmit(){ //do nothing extra } @Override public boolean isVersioned() { return false; } } ´ public String getPageTitleKey() { return searchpage.pagetitle; } public String getPageContextKey() { return searchpage; } @Override public String getContentWidth() { return 850px; } public String getname() { return name; } public void setname(String name) { this.name = name; } } Michael Sparer wrote: the page reloading itself is expected behaviour as the form gets submitted, the onSubmit() method should however be called. if you provided us some more code (and the wicket version you're using)? regards, Michael -- View this message in context: http://www.nabble.com/Button-onSubmit-not-called%2C-instead-page-reloads-tp22350921p22351547.html Sent from the Wicket - User 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
Re: Button onSubmit not called, instead page reloads
Edwin, Put a feedback panel on your page - you may have validation errors. Regards - Cemal http://jWeekend.com jWeekend Edwin Ansicodd wrote: Have a page that extends another page that in turn extends org.apache.wicket.markup.html.WebPage. Have added a form that extends org.apache.wicket.markup.html.form.Form to this page. In this form, I have a org.apache.wicket.markup.html.form.Button Button searchButton = new Button(searchButton){ @Override public void onSubmit() { super.onSubmit(); System.out.println(in searchButton); SearchPage.this.updateList(); } in the html for the button: input type=submit wicket:id=searchButton value=submit/ but when I click the button, instead of calling the onSubmit(), the page itself is reloaded. Would anyone have any ideas what might be wrong? -- View this message in context: http://www.nabble.com/Button-onSubmit-not-called%2C-instead-page-reloads-tp22350921p22351673.html Sent from the Wicket - User 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
Re: Button onSubmit not called, instead page reloads
Added a feedback panel to the page, but no additional information appears. jWeekend wrote: Edwin, Put a feedback panel on your page - you may have validation errors. Regards - Cemal http://jWeekend.com jWeekend -- View this message in context: http://www.nabble.com/Button-onSubmit-not-called%2C-instead-page-reloads-tp22350921p22352004.html Sent from the Wicket - User 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
Re: Button onSubmit not called, instead page reloads
more code continued. . . import org.apache.wicket.markup.html.WebPage; public abstract class BasePage extends WebPage { private CustomFeedbackPanel feedback; public BasePage() { super(); init(); } private void init() { add(new BookmarkablePageLink(PageLink, InfoPage.class)); ContentBorder c = new ContentBorder(content); c.add( feedback = new CustomFeedbackPanel(feedback) ); add( c ); } protected ContentBorder getContentContainer(){ return (ContentBorder)get(content); } @Override protected void onBeforeRender() { super.onBeforeRender(); boolean showfeedback = getSession().getFeedbackMessages().size() != 0; this.feedback.setVisible(showfeedback); } public abstract String getPageTitleKey(); public abstract String getPageContextKey(); protected HttpServletRequest getHttpRequest(){ return ((WebRequest)getRequest()).getHttpServletRequest(); } public abstract String getContentWidth(); @Override public boolean isVersioned() { return false; } protected class ContentBorder extends Border{ public ContentBorder(String id) { super(id); WebMarkupContainer wmc = new WebMarkupContainer(contentBorder); wmc.add( new AttributeModifier(style, true, new Model(width: + getContentWidth() + ;) ) ); add( wmc ); wmc.add(getBodyContainer()); } } } -- View this message in context: http://www.nabble.com/Button-onSubmit-not-called%2C-instead-page-reloads-tp22350921p22352441.html Sent from the Wicket - User 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
Re: Button onSubmit not called, instead page reloads
more code continued. . . import org.apache.wicket.markup.html.WebPage; public abstract class BasePage extends WebPage { private CustomFeedbackPanel feedback; public BasePage() { super(); init(); } private void init() { add(new BookmarkablePageLink(PageLink, InfoPage.class)); ContentBorder c = new ContentBorder(content); c.add( feedback = new CustomFeedbackPanel(feedback) ); add( c ); } protected ContentBorder getContentContainer(){ return (ContentBorder)get(content); } @Override protected void onBeforeRender() { super.onBeforeRender(); boolean showfeedback = getSession().getFeedbackMessages().size() != 0; this.feedback.setVisible(showfeedback); } public abstract String getPageTitleKey(); public abstract String getPageContextKey(); protected HttpServletRequest getHttpRequest(){ return ((WebRequest)getRequest()).getHttpServletRequest(); } public abstract String getContentWidth(); @Override public boolean isVersioned() { return false; } protected class ContentBorder extends Border{ public ContentBorder(String id) { super(id); WebMarkupContainer wmc = new WebMarkupContainer(contentBorder); wmc.add( new AttributeModifier(style, true, new Model(width: + getContentWidth() + ;) ) ); add( wmc ); wmc.add(getBodyContainer()); } } } -- View this message in context: http://www.nabble.com/Button-onSubmit-not-called%2C-instead-page-reloads-tp22350921p22352467.html Sent from the Wicket - User 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
Re: Button onSubmit not called, instead page reloads
i just tested your code and it worked for me. maybe there's something wrong in the basepage? or in the markup? Edwin Ansicodd wrote: Some more code: public class SearchPage extends BasePage { private String name = ; public SearchPage(PageParameters parameters) { super(parameters); // TODO Auto-generated constructor stub init(); } private void init() { Form form = new SearchForm(searchForm); getContentContainer().addOrReplace(form); getContentContainer().addOrReplace(new Label(result,).setVisible(false)); } class SearchForm extends Form{ public SearchForm(String id){ super(id); TextField Name = new TextField(search.tf.name, new PropertyModel(SearchPage.this, name)); add(Name); Button searchButton = new Button(searchButton){ @Override public void onSubmit() { super.onSubmit(); System.out.println(in searchButton); SearchPage.this.updateList(); } }; add( searchButton ); } public void onSubmit(){ //do nothing extra } @Override public boolean isVersioned() { return false; } } ´ public String getPageTitleKey() { return searchpage.pagetitle; } public String getPageContextKey() { return searchpage; } @Override public String getContentWidth() { return 850px; } public String getname() { return name; } public void setname(String name) { this.name = name; } } Michael Sparer wrote: the page reloading itself is expected behaviour as the form gets submitted, the onSubmit() method should however be called. if you provided us some more code (and the wicket version you're using)? regards, Michael - Michael Sparer http://techblog.molindo.at -- View this message in context: http://www.nabble.com/Button-onSubmit-not-called%2C-instead-page-reloads-tp22350921p22354350.html Sent from the Wicket - User 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
Re: Button onSubmit not called, instead page reloads
Thank you for checking it out!! I'm going through the html now. Michael Sparer wrote: i just tested your code and it worked for me. maybe there's something wrong in the basepage? or in the markup? -- View this message in context: http://www.nabble.com/Button-onSubmit-not-called%2C-instead-page-reloads-tp22350921p22356928.html Sent from the Wicket - User 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
Re: Button onSubmit not called, instead page reloads
Here's the culprit: wicket:link # Home {above is an html link} Don't know why I used wicket:link -- View this message in context: http://www.nabble.com/Button-onSubmit-not-called%2C-instead-page-reloads-tp22350921p22357126.html Sent from the Wicket - User 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