cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <>
Subject Re: [cforms] default values and locale
Date Mon, 22 Dec 2003 17:43:16 GMT
Timothy Larson wrote:

>I was just adding a "default" attribute to the Field widget, but then I started thinking...

Hehe, thinking before coding is often a good thing ;-)

>For a Field widget a default value could be specified as either an attribute or as the
contents of a new element (e.g. <wd:default/>).
>Which do you think is better, and what would be a good name?
>I lean toward:
>  <wd:default>
>    <wd:value>Put default value here</wd:value>
>  </wd:default>
>With this syntax we could also allow setting default values for MultiValueField's by just
adding more <wd:value> elements.
>The default value in the definition is specified as a string, which must be interpreted
according to some locale to be converted to the actual value.  Because the locale is relative
to the definition file rather than to a client, the string to value conversion can happen
at definition load time, saving processing during form creation.
>Also, what should we do if the default value should vary based on the client's locale?
 For this use case should the default use i18n substitution and string to value conversion
at form creation time?
>Keeping in mind that i18n affects when the default value is processed, how should we mark
or notice when it is requested?

Why don't you do it the way it's done in the <wb:value> binding? For 
binding to an XML document, it is possible to specify a convertor, that 
can be totally different from the one that will be used to display the 
value to the user. Note that this converter is optional, and if not 
present, the default converter for the datatype is used.


Sylvain Wallez                                  Anyware Technologies 
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }
Orixo, the opensource XML business alliance  -

View raw message