FWIW, this is how I am testing this if anyone wants to see if they see the
same issue:

The dictionary entry:
       <xxx>
           <label>xxx</label>
           <comment/>
           <maxlength>9</maxlength>
           <invalidType>The xxx field does not contain valid data.  This
field must be a string value.</invalidType>
           <invalidLength>The xxx field is too long.  This field must be no
more than 9 characters long.</invalidLength>
       </xxx>

This passes:
<cfset xxx = RepeatString("0",255) />
<cfscript>
MyRecord.setXxx(xxx);
MyRecord.validate();
ErrorCollection = MyRecord._getErrorCollection();
</cfscript>
ErrorCollection.count() is 0



This fails:
<cfset xxx = RepeatString("0",256) />
<cfscript>
MyRecord.setXxx(xxx);
MyRecord.validate();
ErrorCollection = MyRecord._getErrorCollection();
</cfscript>
ErrorCollection.count() is 1


On 1/24/07, Dave Shuck <[EMAIL PROTECTED]> wrote:

I have kind of a fringe case in which the acceptable validation length for
a particular column needs to be different than the length in the database.
The reason is that the setter/getter for that property encrypt/decrypt the
value, so that the length of the encrypted value will be 64 alpha characters
long with the unencrypted value being 9 characters long.  Even though the
actual value of the property is an encrypted 64 char alpha string, the
custom getXxx() returns the unencrypted 9 character string.   Since the
validate() method uses the getXxx() methods, the encryption shouldn't get in
the way of the validation process since I am using the custome getter.

The column in the database is actually set as varchar(255), but I would
like to validate the field to a maxlength of 9.   I think there might be a
bug here unless I am misunderstanding how it should work.  In the dictionary
I changed generated <maxlength>255</maxlength> to
<maxlength>9</maxlength>.   Even though I have done this it appears that any
length up to 255 still validates properly and that the <maxlength/> is being
ignored.

There are very few cases where you would want to validate a different
length than the database definition, so I am suspecting that this just might
be a bug that hasn't been uncovered.   I realize I can write a custom
validation method as a workaround, but it seems like this should have done
the trick.  Does anyone have any input on this?

--
~Dave Shuck
[EMAIL PROTECTED]
www.daveshuck.com

Where's your Spot?
www.instantspot.com
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- --
Reactor for ColdFusion Mailing List
[email protected]
Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- --




--
~Dave Shuck
[EMAIL PROTECTED]
www.daveshuck.com

Where's your Spot?
www.instantspot.com


-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Reactor for ColdFusion Mailing List
[email protected]
Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

Reply via email to