package org.apache.wicket.examples.compref;
import org.apache.wicket.examples.WicketExamplePage;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.panel.FeedbackPanel;
@link
@author
public class FormPage extends WicketExamplePage
{
public FormPage()
{
FeedbackPanel feedbackPanel = new FeedbackPanel("feedback");
add(feedbackPanel);
add(new Form<Void>("form")
{
@Override
protected void onSubmit()
{
info("the form was submitted!");
}
});
}
@Override
protected void explain()
{
String html = "<form wicket:id=\"form\">\n"
+ "<input type=\"submit\" value=\"click me to submit the form and display a message\" />\n"
+ "</form>\n" + "<span wicket:id=\"feedback\">feedbackmessages will be put here</span>";
String code = " public FormPage() {\n"
+ " // Add a FeedbackPanel for displaying our messages\n"
+ " FeedbackPanel feedbackPanel = new FeedbackPanel(\"feedback\");\n"
+ " add(feedbackPanel);\n"
+ "\n"
+ " // Add a form with an onSubmit implementation that sets a message\n"
+ " add(new Form(\"form\") {\n"
+ " protected void onSubmit() {\n"
+ " info(\"the form was submitted!\");\n"
+ " }\n"
+ " });\n" + " }";
add(new ExplainPanel(html, code));
}
}