Hi,

A hot discussion we are having here,

I think there is no new API here. Only thing needed is just a single interface. As I mentioned before most of the validators do not need any conversion before validating the input at all. We could embed converters like number and date to the client validation infrastructure since they act more like a validator at client side and prevent the invalid data to be posted. They work on java objects at server side, but at client, they could simply act as a validator.

Let me clarify it, let's say an inputtext has an integeronly converter, the rendered js function would be something like validateInteger validating whether the input is an int or not. Date is also the same, validates according to the pattern. Isn't simple better? just prevent the invalid data to be posted.

+1 for the validation event like onkeypress, onblur and etc, they are very useful and very easy to implement by decorating the textrenderer. I've done it in my current project.

btw I'll be glad to receive your help Mario :)

Cagatay

On 7/13/06, Mario Ivankovits <[EMAIL PROTECTED]> wrote:
Hi Adam!

Hmmm .... ok, I understand the "chained validator" thing.

So, even if we go the client side converter way, I would like to have a
way to define the "allowed characters" for the input field.

Maybe by adding a method like
InputMask getInputMask()
to the ClientConverter interface. This return a regexp which we can use
to check onkeypress et al if the input is syntactically correct.

We can have this on the ClientValidator too (for validateEMail,
validateISBN etc) and always check all masks associated to the field.

A number converter will return "[0-9]*" as mask, but the ClientValidator
might be smart enough (say a range validator 100-1000) to create a
regexp like "^[0-9]{0,4}$"

The InputMask might be a structure which returns not only the regexp,
but also a human readable form of it.

So the converter will return "Numerical Input" and the validator
something like "In the range from 100 to 1000". We can put this in the
status line of the browser then to assist the user even more.


Yes, you are right that it is better to have the ClientConverter and
pass this value to the ClientValidator.
Thanks Adam for the lesson - this is why I like open-source, you will be
teached for free ;-)

Ciao,
Mario


Reply via email to