You might want to look at class widgets http://wiki.apache.org/cocoon/TimLarson . With a class you can define (in ONE definition/binding/template) a class widget and instantiate it multiple times. So you could create a class with a date widget and use several instances of that class. But you need to know that the binding will have to be the same. So every date element has to have the same bean/xml element to bind to, but they might be in different contexts.
<fd:class id="dateClass">
<fd:widgets>
<fd:field id="date">
<fd:datatype base="date">
<fd:convertor type="formatting">
<fd:patterns>
<fd:pattern>dd/MM/yyyy</fd:pattern>
</fd:patterns>
</fd:convertor>
</fd:datatype>
</fd:field> </fd:widgets>
</fd:class>
then instantiate with : <fd:new id="dateClass/>
binding goes the same, you may change it context, but the actual element binding path will be the same for each instance (it's in the class, remember):
<fb:class id="dateClass"> <fb:value id="date" path="date"/> </fb:class>
<fb:context path="somewhere"> <fb:new id="dateClass"/> </fb:context>
There are some discussions for new stuff, including "catalogs" or "repositories" with widgets that you can easily reuse: http://wiki.apache.org/cocoon/WoodyScratchpad
Kind Regards, Jan
Luca Garulli wrote:
Can I define a global date format avoiding to specifing it everytime in definition & mapping?
Thanks.
bye, Luca Garulli OrienTechnologies.com (the light ODBMS, all in one JDO solution)
On Thu, 14 Oct 2004 08:53:17 +0200, Jan Hoskens <[EMAIL PROTECTED]> wrote:
Do you mean entering a date in the webbrowser? When setting a date in the definition with a specified format, this format is used for entering dates in the input fields of your browser. If you want your date format in your xml file (binded data source/destination) you need to set your binding formatting.
So <fd:field id="input"> <fd:label>mylabel</fd:label> <fd:datatype base="date"> <fd:convertor type="formatting"> <fd:patterns> <fd:pattern>dd/MM/yyyy</fd:pattern> </fd:patterns> </fd:convertor> </fd:datatype> </fd:field>
Would make you're browser inputfield accept the defined format (if this is what you needed, didn't it work? Also when specifying a pattern, try leaving out the style="long" attribute.)
The next sample should set the date format in your xml file that was binded to your form:
<fb:value id="input" path="input"> <fd:convertor datatype="date"> <fd:patterns> <fd:pattern>dd/MM/yyyy</fd:pattern>
</fd:patterns> </fd:convertor> </fb:value>
Hope this helps.
Kind Regards, Jan
[EMAIL PROTECTED] wrote:
Hi , How can we change the cocoon default date format. cocoon is accepts MM/dd/YY. When we change the format as YYYY-mm-DD. Cocoon doesn't allows us to enter date in this format.
We have the tried the following :
<fd:field id="Date"> <fd:label><i18n:text> Date: </i18n:text></fd:label> <fd:datatype base="date"> <fd:converter type="formatting" style="long"> <fd:patterns> <fd:pattern>YYYY-mm-DD</fd:pattern> </fd:patterns> </fd:converter> </fd:datatype> <fd:validation /> </fd:field>
Can any one please let us know where we are going wrong or any pointer to achieve the same would appreciated Thanks in advance. Regards, Moin
Confidentiality Notice
The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain confidential or privileged information. If you are not the intended recipient, please notify the sender at Wipro or [EMAIL PROTECTED] immediately and destroy all copies of this message and any attachments.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]