Re: [Jvalid-devel] User defined messaging?
Status: Alpha
Brought to you by:
mikewill_1998
|
From: Mike W. <mik...@st...> - 2001-04-20 02:40:22
|
Brett McLaughlin wrote:
> ----- Original Message -----
> From: "Mike Williams" <mik...@st...>
> To: <jva...@li...>
> Sent: Thursday, April 19, 2001 8:38 PM
> Subject: [Jvalid-devel] User defined messaging?
>
>
>
>> Thought I should post this to the list since we have some new blood :)
>> BTW, Welcome Brett!
>
>
> Hey there... couldn't not at least see what came of my articles ;-)
Hope you like what you see so far :) And if you want commit access to
the repository just say the word and your in!
>
>
>> Mark and I were discussing ways of adding user defined messagging to
>> JValid. Here is one idea that sounds like it would work. Feed back is
>> welcome!
>
>
> I'll give you what I can. I may be a little loopy... I'm in my normal frenzy
> this time of year, as its the Stanley Cup Playoffs, and my Dallas Stars are
> on tonight ;-)
Good luck :)
>
>
>> Here is the proposed change to the xml. The new attributes are
>> friendlyName, minInclusiveMessage and maxInclusiveMessage. There would
>> be a matching ??Message attribute for each possible validation error.
>> The strings enclosed in {{ }} would be replaced at runtime with the
>> appropriate values.
>>
>> <attribute name="orderDate">
>> <simpleType baseType="date">
>> <minInclusive value="2/28/2001" />
>> <maxInclusive value="5/28/2001" />
>> </simpleType>
>> <friendlyName value="Order Date" />
>> <minInclusiveMessage value="The value {{value}} is less than the
>> minimum allowed value {{minInclusive}} for {{friendlyName}}." />
>> <maxInclusiveMessage value="The value {{value}} is greater than the
>> maximum allowed value {{maxInclusive}} for {{friendlyName}}." />
>> </attribute>
>
>
> A couple of thoughts. First, it would make more sense to me to include the
> message element more closely with the constraint involved. This actually
> brings up something I've been thinking about: since we're now to the point
> of defining elements, and not just using the XML Schema ones, it might make
> sense to define a 'constraint' element that is the baseType for all
> constraints. Then you might have something like this:
>
> <attribute name="orderDate">
> <jvalid:constraint uiName="Order Date" baseType="date">
> <jvalid:minInclusive value="2/28/2001">
> <errorMessage>The value ${value} is less than the minimum allowed
> value ${minInclusive} for ${uiName}</errorMessage>
> </jvalid:minInclusive>
> </jvalid:constraint>
> </attribute>
>
> Something like that... so jvalid:constraint would extend XML Schema's
> constraint element, jvalid:minInclusive would extend XML Schema's
> minInclusive, etc. That sort of consolidates the UI Name with the name of
> the element/attribute, which makes more sense to me. It also allows the
> error message to be a part of the constraint, which also rings truer.
>
> My 2 cents ;-) Whatcha think?
>
> -Brett
I like! It does make much more sense this way. My idea was basically
conceived as it was written.., usually not a very good idea.., but, can
spark some lively and productive discussions :) Note to self.., think
before posting! :)
Mike
|