I have an object that want to embed it in a form. My custom object has its complicated validation mechanism (not just validators in wicket.markup.html.form.validation.*) , what should I do ?
For example : MyDatePicker , that will check if you pickup February , and it will check if 'day' is larger than 29 (leap year) or 28(average year) . MyDatePicker is not standalone , it may be embed in other forms. I thought there are two ways: 1. Make MyDatePicker extends Panel , and write MyDatePickerValidator implements IFormValidator so , I can use : form.add(myDatePicker); form.add(myDatePickerValidator); Is it correct ??? If it is correct , it seems MyDatePickerValidator is decoupled with MyDatePicker 2. Make MyDatePicker extends FormComponent and write MyDatePickerValidator implements IValidator , in the code : form.add(myDatePicker.add(myDatePickerValidator)); Is it correct ? Which is the better way ? BTW , is there any further documents about how to write custom FormComponent ? I tried to write class extends FormComponent , but it throws WicketRuntimeException : The component(s) below failed to render. A common problem is that you have added a component in code but forgot to reference it in the markup ... I don't know why it happens , I am sure the components in code match the wicket:id in HTML template Another question , in the javadoc of IValidator , it says "if none satisfies your need, subclass CustomValidator" , but in javadoc of CustomValidator , it shows "Deprecated. Users should use StringValidator directly" . But I am not going to do String validation.... , what should I do ?? _______________________________________________ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user