in my eyes this is logical.
Because First you convert then you validate..
Validators should be done on the Real objects.
And now you suddenly want an exception in the StringValidator where you reconvert that you just converted???
that is by the way exactly the same as doing this:

onValidate(formComponent, (String)formComponent.getInput());

getInput is directly the input out of the request.

But why would you have a maxlength of a pattern validator to the usphonenumber?
because what you want to validato is already validated in the converter. Because the converted needs a X  string length in a pattern xxx-0xxx-xxx
And it will fail if that is not the case.

johan


On 5/4/06, Alexei Sokolov <[EMAIL PROTECTED]> wrote:
It can be debated if it is a bug fix or enhancement, but the problem is you cannot use any of the string validators with non-string types. For example, you cannot have StringValidator.maximumLength () or PatterValidator attached to a field of  type UsPhoneNumber.class. Please correct me if I'm wrong. You can use something like MaskConverter, for example, but that's different.

I propose to change the following code in StringValidator:

public void validate(final FormComponent formComponent)
{
  onValidate(formComponent, (String)formComponent.getConvertedInput());
}

with something like onValidate(formComponent, getConvertedInputAsString()) where getConvertedInputAsString() makes call to converter to convert the value back to String.

Alex

Reply via email to