cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeremy Quinn <>
Subject Re: [woody] validation error messages
Date Tue, 11 Nov 2003 14:03:55 GMT

On 11 Nov 2003, at 13:27, Sylvain Wallez wrote:

> Jeremy Quinn wrote:
>> Dear All
>> I noticed that when you use something like :
>>     form.getWidget ("email").setValidationError (
>>         new ValidationError ("")
>>     );
>> then the i18n tag output by setValidationError() looks like this:
>>     <i18n:text catalogue="woody"></i18n:text>
> Note that you can also use the second constructor which specifies if 
> the string is an i18n key or the final message, i.e.:
> new ValidationError("Bad input!", false);

and    new ValidationError("some.message.key", true);


>> which means that any custom validation errors pretty much have to be 
>> kept in WoodyMessages which could well be inconvenient ....
> Sure, you're right.
>> Is it really necessary for Woody to set the catalogue attribute in 
>> this situation?
> I would say no, but I'm not very aware of the multicatalogue i18n 
> features.

I got this pattern from the Woody Samples, the sitemap is set up to use 
the "OtherMessages" catalogue as default, with the WoddyMessages 
catalogue as fallback, though currently "OtherMessages" is empty.

> Isn't it possible to specify no attribute and have the i18n 
> transformer search all declared catalogues?

Yes, but .... when you use setValidationError the catalogue attribute 
is added automatically, I don't think there is a option to turn this 
off. I have not seen this i18n behaviour on any other bit of Woody.

I am using multiple catalogues, the supplied woody one, which 
unfortunately I now have to copy and modify with my messages output by 
setValidationError, and my Applications catalogues (sitemap default), 
where I put application-specific messages (I have several logical 
groups of forms, each in a separate sitemap, with their own message 

One thing that is confusing, is that custom messages output like this:

<wd:assert test="password != firstname">
only seem to work when the message is in my application catalogue.

While messages output like this:

form.getWidget ("email").setValidationError (
	new ValidationError ("", true)

only appear to work if the message is in the 'woody' catalogue.

>> BTW. Is there a plan to add a generic form validation message tag to 
>> woody? ie. not tied to a particular field widget.
> A widget that would collect all error messages? IIRC, this has been 
> discussed.


Do you mean, collect from all widgets?
Or, collect all messages sent to the form widget (which does not 
currently accept them)?


regards Jeremy

View raw message