You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Joern Wallstabe <jo...@igd-r.fraunhofer.de> on 2004/02/09 12:17:59 UTC

i18n - how to get localized message after form validation

Hi everyone,

I'm using woody and  I have to use flow validation functions for form validation.

How can I get a localized (!!)  message from these function back in my form if validation fails ?

Can I achive this by using i18n transformer functionality ?

Regrads Jörn


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: i18n - how to get localized message after form validation

Posted by Joern Wallstabe <jo...@igd-r.fraunhofer.de>.
On Sat, 21 Feb 2004 01:13:37 +0100
Joerg Heinicke <jo...@gmx.de> wrote:

> On 10.02.2004 17:54, Joern Wallstabe wrote:
> 
> >>>How can I get a localized (!!)  message from these function back in my form if validation fails ?
> > 
> > I tried different approaches, but it's not working (cocoon snapshot 2.1.4 - 24.11.03)
> > I'm always getting the key String an not the catalogue value.
> > 
> > (1)
> > var validationError = new Packages.org.apache.cocoon.woody.datatype.ValidationError("xxx");
> > form.getWidget("my_widget").setValidationError(validationError,true);
> 
> This one should work. Did you tried it with a more recent snapshot or 
> the 2.1.4 release?
> 
> Joerg
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 

Hi Joerg,

got it working in cocoon 2.1.4 release.

var i18nMessage = new Packages.org.apache.cocoon.woody.util.I18nMessage("error_end_before_start");
form.getWidget("messages").addMessage(i18nMessage);

Thank you

Jörn

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: i18n - how to get localized message after form validation

Posted by Joerg Heinicke <jo...@gmx.de>.
On 10.02.2004 17:54, Joern Wallstabe wrote:

>>>How can I get a localized (!!)  message from these function back in my form if validation fails ?
> 
> I tried different approaches, but it's not working (cocoon snapshot 2.1.4 - 24.11.03)
> I'm always getting the key String an not the catalogue value.
> 
> (1)
> var validationError = new Packages.org.apache.cocoon.woody.datatype.ValidationError("xxx");
> form.getWidget("my_widget").setValidationError(validationError,true);

This one should work. Did you tried it with a more recent snapshot or 
the 2.1.4 release?

Joerg

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: i18n - how to get localized message after form validation

Posted by Joern Wallstabe <jo...@igd-r.fraunhofer.de>.
On Tue, 10 Feb 2004 02:53:07 +0100
Joerg Heinicke <jo...@gmx.de> wrote:

> On 09.02.2004 12:17, Joern Wallstabe wrote:
> 
> > Hi everyone,
> > 
> > I'm using woody and  I have to use flow validation functions for form validation.
> 
> In which way do you use them?
> 
> > How can I get a localized (!!)  message from these function back in my form if validation fails ?
> 
> I ask, because if you do it like in the updated sample [1] via 
> ValidationError object, the first parameter is either already localized 
> text or an i18n key. It depends on the second parameter set to true or 
> false. For details have a look into the ValidationError class [2].
> 
> > Can I achive this by using i18n transformer functionality ?
> 
> This one is for transforming the i18n elements into localized messages. 
> The problem seems to be more to get the i18n elements into your XML 
> structure.
> 
> Joerg
> 
> [1] 
> http://cvs.apache.org/viewcvs.cgi/cocoon-2.1/src/blocks/woody/samples/forms/form1.xml?annotate=1.20#235
> [2] 
> http://cvs.apache.org/viewcvs.cgi/cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/validation/ValidationError.java?annotate=1.1#50
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 

Thanks for the reply,

I tried different approaches, but it's not working (cocoon snapshot 2.1.4 - 24.11.03)
I'm always getting the key String an not the catalogue value.

(1)
var validationError = new Packages.org.apache.cocoon.woody.datatype.ValidationError("xxx");
form.getWidget("my_widget").setValidationError(validationError,true);

(2)
var message= new Packages.org.apache.cocoon.woody.util.I18nMessage("key", "my_catalogue")
form.getWidget("my_widget").setValidationError(message);

(3)
var message= new Packages.org.apache.cocoon.woody.util.I18nMessage("key")
form.getWidget("my_messages_widget").addMessage(message);

am I missing something ?

Regards Jörn 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: i18n - how to get localized message after form validation

Posted by Joerg Heinicke <jo...@gmx.de>.
On 09.02.2004 12:17, Joern Wallstabe wrote:

> Hi everyone,
> 
> I'm using woody and  I have to use flow validation functions for form validation.

In which way do you use them?

> How can I get a localized (!!)  message from these function back in my form if validation fails ?

I ask, because if you do it like in the updated sample [1] via 
ValidationError object, the first parameter is either already localized 
text or an i18n key. It depends on the second parameter set to true or 
false. For details have a look into the ValidationError class [2].

> Can I achive this by using i18n transformer functionality ?

This one is for transforming the i18n elements into localized messages. 
The problem seems to be more to get the i18n elements into your XML 
structure.

Joerg

[1] 
http://cvs.apache.org/viewcvs.cgi/cocoon-2.1/src/blocks/woody/samples/forms/form1.xml?annotate=1.20#235
[2] 
http://cvs.apache.org/viewcvs.cgi/cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/validation/ValidationError.java?annotate=1.1#50

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org