Try the following:
form.add(new TextField("carmillage", carMillage,
Integer.class).add(NumberValidator.minimum(0)));
Erik.
Nino Wael wrote:
>
> Hi
>
>
>
> Im getting an exception when I submit my page(base cause line 205 I
> numbervalidator). Im a bit puzzled by this since I cant understand why
> it should happened.
>
>
>
> Entering a text string triggers the error, but that’s the reason why I
> put in the numbervalidator in the first place.. I’ve been looking at
> the forminput from wicket examples and my code appear to be ok:
>
>
>
> final FormModel formModel
> = new FormModel();
>
>
>
> final PropertyModel
> carModel = new PropertyModel(formModel, "carModel");
>
> final PropertyModel
> carYear = new PropertyModel(formModel, "carYear");
>
> final PropertyModel
> carMillage = new PropertyModel(formModel,
>
>
>
> "carMillage");
>
> final PropertyModel
> carFailureText = new PropertyModel(formModel,
>
>
>
> "carFailureText");
>
>
> FormComponentFeedbackBorder feedbackBorder = new
> FormComponentFeedbackBorder(
>
>
>
> "feedback");
>
> add(feedbackBorder);
>
> Form form = new
> Form("theform");
>
> feedbackBorder.add(form);
>
> form.add(new
> DropDownChoice("carmodel", carModel, Offline
>
>
>
> .getCarsFromBrand("Opel")));
>
> form.add(new
> RadioChoice("caryear", carYear, Offline.getCarYears()));
>
> form.add(new
> TextField("carmillage", carMillage).add(NumberValidator
>
>
>
> .minimum(0)));
>
> form.add(new
> TextArea("carfailuretext", carFailureText)
>
>
>
> .setRequired(true));
>
>
>
> form.add(new
> Button("btn_submit") {
>
>
> protected void onValid() {
>
>
>
>
>
> CompoundPropertyModel model = new CompoundPropertyModel(
>
>
>
> formModel);
>
>
>
> setResponsePage(new ThankYouPage(model));
>
> };
>
> });
>
>
>
> }
>
>
>
>
>
> Regards Nino
>
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys - and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> ------------------------------------------------------------------------
>
> _______________________________________________
> Wicket-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>
--
Erik van Oosten
http://www.day-to-day-stuff.blogspot.com/
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user