Hi Ramsey,

I'm a little confused here.  There must be some kind of context that it's using 
by default, because most of the messages are correct.  The other thing I don't 
understand is if there is no attribute() method on ERXValidationException why 
then does the following template string render properly?

"ExceedsMaximumLengthException" = "The value entered for 
<b>@@displayNameForProperty@@</b> exceeds the length of 
<b>@@attribute.width@@</b>.";

Sorry, I guess I just don't fully understand how this mechanism fully works 
yet.  I know you pointed me in a similar direction back in Sep. when I was 
having trouble with the articles displaying properly, but I thought those 
issues were all d2w related.  Now that I'm no longer using any d2w I'm even 
more confused.  :)

Thanks.
-Mike


On Oct 19, 2011, at 4:35 PM, Ramsey Gurley wrote:

Hi Mike,

On Oct 19, 2011, at 10:52 AM, Michael Gargano wrote:

Hi all,

I'm still having some occasional issues with EOF validations (2 things in 
particular)...


1) For some attributes (it seems like attributes that are type intNumber, but 
there may be others too), I'm getting validation error messages that end with 
"is not a valid ?".
I had that problem the other month on all my attributes, but it had to with the 
d2w libs I had in the build path at the time, those are gone now and I don't 
know why this happens or the best way to handle it.

In ERExtensions ValidationTemplate.strings file I see:

"ValueConversionException" = "The value entered for 
<b>@@displayNameForProperty@@</b> is not a valid 
<b>@@attribute.valueClass@@</b>.";

The display name for your property is created correctly because there is a 
displayNameForProperty() method on ERXValidationException.

There's no attribute() method on ERXValidationException, so it goes to the 
validation context object for an answer.

If you don't have a validation delegate to supply a context and you haven't set 
a context manually, you end up with a '?' replacement character.


2) Somewhat related to this... I have some EO attributes with names that make 
sense in the business domain, but should be called something else when surfaced 
to the user.  So, the attribute might be fancyBusinessObjectName, but when I 
catch the exception and show the message I want it to be displayed as "User Non 
Scary Name".

Is there a way to do either of these things without just doing string 
replacements on the message from the exception, perhaps something in userInfo?


Thanks.
-Mike

In the example above, you could add something like:

"PropertyKey.fancyBusinessObjectName" = "User Non Scary Name";

To your english strings file and get the desired results. It's also done as

"MyEntityName.fancyBusinessObjectName" = "User Non Scary Name";

In some places. Not sure which will work for you.


Ramsey


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to