You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Alexander Lurk <al...@googlemail.com> on 2006/03/23 18:59:13 UTC

Validation problem by using widget field with datatype base="date"

Hi

I have a validation problem by using a widget field with datatype base="date".
The sitemap and model looks like the following:

Sitemap:
----- snip -----
...
<map:pipeline internal-only="true">
  <map:match pattern="*-display-pipeline">
    <map:generate src="TestTemplate.xml"/>
    <map:transform type="forms">
      <map:parameter name="locale" value="en-EN"/>
    </map:transform>
    <map:transform type="i18n">
      <map:parameter name="locale" value="en-EN"/>
    </map:transform>
    <map:transform src="test-styling.xsl"/>
    <map:serialize/>
  </map:match>
</map:pipeline>
...
----- snip -----

Model:
----- snip -----
...
<fd:field id="TestDate" required="true">
  <fd:datatype base="date"/>
  <fd:label><i18n:text i18n:key="TestDate"/></fd:label>
</fd:field>
...
----- snip -----

If I choose after running with the help of the calendar a date (day)
it will be taken over in the input field in the following format:
3/23/06
That's correct.
But if I press now the submit button the validation of the date failed
with the message "Not a valid date"!!!

If I change the language in the sitemap to German (de-DE) I get the
date 23.03.06 and no validation problem. In this case if works fine.

What's wrong?

Is it possible to solve the problem by using the i18n transformer
(<i18n:date ... />)?
If yes how?

Remark: I'm using Cocoon 2.1.8 and the german version of Mozilla
Firefox 1.5.0.1.

Thanks for your help
Alex

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


Re: Validation problem by using widget field with datatype base="date"

Posted by Bruno Dumon <br...@outerthought.org>.
On Thu, 2006-03-23 at 18:59 +0100, Alexander Lurk wrote:
> Hi
> 
> I have a validation problem by using a widget field with datatype base="date".
> The sitemap and model looks like the following:
> 
> Sitemap:
> ----- snip -----
> ...
> <map:pipeline internal-only="true">
>   <map:match pattern="*-display-pipeline">
>     <map:generate src="TestTemplate.xml"/>
>     <map:transform type="forms">
>       <map:parameter name="locale" value="en-EN"/>
>     </map:transform>
>     <map:transform type="i18n">
>       <map:parameter name="locale" value="en-EN"/>
>     </map:transform>
>     <map:transform src="test-styling.xsl"/>
>     <map:serialize/>
>   </map:match>
> </map:pipeline>
> ...
> ----- snip -----
> 
> Model:
> ----- snip -----
> ...
> <fd:field id="TestDate" required="true">
>   <fd:datatype base="date"/>
>   <fd:label><i18n:text i18n:key="TestDate"/></fd:label>
> </fd:field>
> ...
> ----- snip -----
> 
> If I choose after running with the help of the calendar a date (day)
> it will be taken over in the input field in the following format:
> 3/23/06
> That's correct.
> But if I press now the submit button the validation of the date failed
> with the message "Not a valid date"!!!
> 
> If I change the language in the sitemap to German (de-DE) I get the
> date 23.03.06 and no validation problem. In this case if works fine.
> 
> What's wrong?

You might be missing the locale setting on the form object in the
flowscript:

form.locale = new java.util.Locale("en-EN")

The locale settings you did in the pipeline influence the rendering of
the form, the locale setting on the form object influences the reading
and processing of the form data from the http request. These two locales
(rendering & processing) should always match. Currently it is up to you
to make sure this is the case, maybe in the future Cocoon will have a
more generalized locale setting.

See also "using i18n" on
http://cocoon.apache.org/2.1/userdocs/basics/improving_sample.html

> 
> Is it possible to solve the problem by using the i18n transformer
> (<i18n:date ... />)?
> If yes how?
> 
> Remark: I'm using Cocoon 2.1.8 and the german version of Mozilla
> Firefox 1.5.0.1.

The language version of the browser shouldn't matter in this.

-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno@outerthought.org                          bruno@apache.org


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