final TextField<Integer> field = new TextField<Integer>("textfield",
new PropertyModel<Integer>(this, "number"));
field.add(new RangeValidator<Integer>(0, 20));
field.setRequired(true);
StatelessForm<?> statelessForm = new StatelessForm("statelessform")
{
/**
* @see org.apache.wicket.markup.html.form.Form#onSubmit()
*/
@Override
protected void onSubmit()
{
info("Submitted text: " + field.getDefaultModelObject());
// store the value in page parameters
getPage().getPageParameters().set(PARAMETER_NAME, number);
}
};
statelessForm.add(field);
add(statelessForm);
add(new FeedbackPanel("feedback"));
}