myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mario Ivankovits <ma...@ops.co.at>
Subject Re: Client Validation Design Discussion
Date Thu, 13 Jul 2006 08:11:09 GMT
Hi Cagatay!
> A hot discussion we are having here,
Yes, this is great :-)

> 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.
This is not necessarily true. Think about the following stuff:
<h:inputText>
    <s:convertNumber
        maxFractionDigits="2"
        minFractionDigits="2"
        currencySymbol="EUR"
        groupingUsed="true"/>
    <f:validateDoubleRange minimum="100" maximum="1000"/>
    <x:mySpecialValidator onlyAllowMultiplesOf="5" />
</h:inputText>

Now lets see about the problems of the convertNumber. The user has to
input a "non valid" value in the context of JS as there is the
currencySymbol (ok, not very realistic) BUT there is also groupingUsed.
The grouping character is locale specific. and There is min/max Fraction
digits which we CAN'T check using the validator only.
On the other hand the validateDoubleRange do not know ANYTHING about how
the user has to enter the value - it will only work on a already
converted number.
The converter has to convert it - locale specific before. And you cant
easily use the locale on the client as the user might have changed the
used locale on the server.
Say you work on an US system but setup your webapp to use the german locale.

This is why the Trinidad guys are right that we have to define a
ClientConverter too.

> btw I'll be glad to receive your help Mario :)
Maybe I can have a look at the ClientConverter stuff?

Ciao,
Mario


Mime
View raw message