You could do it with a FormValidator but that is more a validator that goes over multiply formcomponents
(like equals input or check if you filled in one of the fields (required over x number of fields not only one field)
Is that validator always there for your DatePicker or is it a standalone validator that
you sometimes use for a datepicker?
If you always want to have a validator with youre special datepicker
Then you just extend the datapicker and in the constructor add your validator.
Please make a but report about that javadoc that is out of sync so that we can look at it.
johan
On 6/12/06, smallufo <
[EMAIL PROTECTED]> wrote:
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user
_______________________________________________ Wicket-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wicket-user
