Since your model doesn't actually know what type of field it is operating on
(like PropertyModel does), you need to call setType(Long.class) on your text
field.

On Tue, Oct 12, 2010 at 1:23 PM, Zeldor <pgronkiew...@gmail.com> wrote:

>
> I have TextField that should take Long value, but on submit it does not
> really work...
>
>
> org.apache.wicket.RequestCycle logRuntimeException: Exception
> 'java.lang.ClassCastException: java.lang.Integer cannot be cast to
> java.lang.Long' occurred during validation
> org.apache.wicket.validation.validator.MinimumValidator on component
> 10:workForm:hire_worker_1
> org.apache.wicket.WicketRuntimeException: Exception
> 'java.lang.ClassCastException: java.lang.Integer cannot be cast to
> java.lang.Long' occurred during validation
> org.apache.wicket.validation.validator.MinimumValidator on component
> 10:workForm:hire_worker_1
>
>
> My code looks like that:
>
> public Work() {
>                add(new FeedbackPanel("errorMsg"));
>                Form<String> workForm = new Form<String>("workForm", new
> Model<String>())
> {
>                        private TextField<Long> hire_worker_1 = new
> TextField<Long>("hire_worker_1", new Model<Long>());
> ...
> {
> ...
> add(hire_worker_1.add(new MinimumValidator(0))
>                                                .setType(Long.class));
> ...
> }
>
> @Override
>                public void onSubmit() {
>                        long hiring_worker_1 =
> hire_worker_1.getModelObject();
>                        ...
> }
>        };
>        add(workForm);
>        }
>
> Eclipse does like "new MinimumValidator<Long>(0)", so what's the solution
> for my problem?
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/MinimumValidator-and-Long-problem-tp2992468p2992468.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
>
>


-- 
Jeremy Thomerson
http://www.wickettraining.com

Reply via email to