some models, eg propertymodel, can tell the component automatically what type it is bound to.
you can open a jira issue for other cleanup issues. -igor On Wed, Aug 26, 2009 at 2:35 PM, T Ames<[email protected]> wrote: > Great! Thanks! > > I know you guys are super busy. One thing to put on the list would be to > update the wicket examples - FormInput.java > > This is still using the NumberValidator and all it's various forms which > have been deprecated. I assume that I would have seen the setType() in > there if it were updated. Something in that older style must have taken > care of that since the examples still work. > > > > > On Wed, Aug 26, 2009 at 5:11 PM, Igor Vaynberg <[email protected]>wrote: > >> testLong.setType(Long.class) >> >> -igor >> >> On Wed, Aug 26, 2009 at 1:41 PM, T Ames<[email protected]> wrote: >> > I cannot seem to get a simple validation to work on a form. Using >> 1.4-rc5. >> > >> > TextField<Long> testLong = new TextField<Long>("testLong", new >> > Model<Long>(0)); >> > testLong.add(new MinimumValidator<Long>(0)); >> > batchForm.add(testLong); >> > >> > I want the text field to be validated as a number, and zero or greater. >> > >> > *Problem 1:* If I remove the MinimumValidator, I get no feedback message >> if >> > I put a non-numeric character in the field, and no errors. >> > >> > *Problem 2: *With the MinimumValidator I get a class cast error: >> > >> > WicketMessage: Exception 'java.lang.ClassCastException: java.lang.Long >> > cannot be cast to java.lang.String' occurred during validation >> > org.apache.wicket.validation.validator.MinimumValidator on component >> > 1:batchArchiveForm:testLong >> > >> > Root cause: >> > >> > java.lang.ClassCastException: java.lang.Long cannot be cast to >> > java.lang.String >> > at java.lang.String.compareTo(String.java:92) >> > at >> > >> org.apache.wicket.validation.validator.MinimumValidator.validate(MinimumValidator.java:50) >> > at >> > >> org.apache.wicket.markup.html.form.FormComponent.validateValidators(FormComponent.java:1585) >> > at >> > >> org.apache.wicket.markup.html.form.FormComponent.validate(FormComponent.java:1174) >> > at org.apache.wicket.markup.html.form.Form$22.validate(Form.java:2098) >> > at >> > >> org.apache.wicket.markup.html.form.Form$ValidationVisitor.formComponent(Form.java:169) >> > at >> > >> org.apache.wicket.markup.html.form.FormComponent.visitFormComponentsPostOrderHelper(FormComponent.java:415) >> > at >> > >> org.apache.wicket.markup.html.form.FormComponent.visitFormComponentsPostOrderHelper(FormComponent.java:402) >> > at >> > >> org.apache.wicket.markup.html.form.FormComponent.visitFormComponentsPostOrder(FormComponent.java:374) >> > at >> > >> org.apache.wicket.markup.html.form.Form.visitFormComponentsPostOrder(Form.java:1182) >> > at >> > >> org.apache.wicket.markup.html.form.Form.validateComponents(Form.java:2090) >> > at org.apache.wicket.markup.html.form.Form.validate(Form.java:2070) >> > at org.apache.wicket.markup.html.form.Form.process(Form.java:961) >> > at org.apache.wicket.markup.html.form.Form.process(Form.java:911) >> > at org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:876) >> > at java.lang.reflect.Method.invoke(Method.java:597) >> > at >> > >> org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:182) >> > at >> > >> org.apache.wicket.request.target.component.listener.ListenerInterfaceRequestTarget.processEvents(ListenerInterfaceRequestTarget.java:73) >> > at >> > >> org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92) >> > at >> > >> org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1241) >> > at org.apache.wicket.RequestCycle.step(RequestCycle.java:1320) >> > at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1419) >> > at org.apache.wicket.RequestCycle.request(RequestCycle.java:545) >> > at >> org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:456) >> > at >> > >> org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:289) >> > >> > ..... >> > >> > I know the feedback messages are working since I have a RequiredTextField >> > set up and it is responding properly. >> > >> > It must be something simple that I am missing... >> > >> > Thanks. >> > >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> >> > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
