Problem with all these solutions, is that we have to differentiate between
'RequiredValidators' and other validators, which means somehow we have to
know which ones to call when. Because now, there is just a list of
validators, added to the component, and they get called by Wicket. What I'm
trying to say is that checking if a field is empty or not can be just a
validator task. Now, we can no longer simply plug that in as just another
validator.

I understand that it is handy not to have to check if a value is null, but
we're paying a price for this that might be higher than the gain ?

Jan.


igor.vaynberg wrote:
> 
> or instead,
> 
> maybe make that hibernatevalidator also be a behavior, and simply toggle
> component's setrequired in onattach
> 
> -igor
> 
> 
> On 6/19/07, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
>>
>> i dont know about that. isvalid's contract is that it only returns false
>> if there are error messages reported against the component.
>>
>> i think this would be simple enough
>>
>> class hibernatetextfield extends textfield {
>>   valid() {
>>     if (hibernaterequired()) {
>>        if (Strings.isEmpty(getInput()[0])) {
>>            error(new ValidationError().addMessageKey("Required"));
>>            return;
>>        }
>>      }
>>      super.validate();
>>   }
>>
>> -igor
> 

-- 
View this message in context: 
http://www.nabble.com/Problem-with-latest-changes-in-FormComponent%3Avalidate%28%29-tf3945885.html#a11200959
Sent from the Wicket - Dev mailing list archive at Nabble.com.

Reply via email to