On Sun, 2004-05-09 at 12:07, roy huang wrote:
> Hi All:
>   If I user xml as data to binding cocoon forms,I must using DateConvertor to 
> convert string to date like:
>   <fb:value id="date"   
>             path="date" >
>     <fd:convertor datatype="date" >
>       <fd:patterns>
>         <fd:pattern>yyyy-MM-dd</fd:pattern>
>       </fd:patterns>
>     </fd:convertor>
>   </fb:value>
> 
> the data may looks like:
> <date>1971-05-06</date>
> 
> But if the data is <date><date> it will error like:
> org.apache.avalon.framework.CascadingRuntimeException: 
> "resource://org/apache/cocoon/forms/flow/javascript/Form.js", line 160: uncaught 
> JavaScript exception: at bindingSample 
> (file:/D:/eclipse/workspace/cocoon-2.1/build/webapp/samples/blocks/forms/flow/bindings.js,
>  Line 73) at (resource://org/apache/cocoon/forms/flow/javascript/Form.js, Line 160): 
> java.lang.RuntimeException: Incorrect value type for "date" (expected class 
> java.util.Date, got class java.lang.String.
> 
> But it works only several days ago,so I check the cvs and believe is Bruno's change 
> in 5.6 makes it. Here's what he said in cvs comments:
> 
> Made Convertor.convertFromString contract more solid by letting it
> return a ConversionResult object (instead of null/not-null to indicate
> successful conversion). This also moves the responsibility
> of creating the ValidationError to the Convertor, allowing convertors
> to set more specialised messages in them.
> 
> What can I do to convert an blank ("") string to Date type? Or this should be 
> considered in the FormattingDateConvert.java?I believe this function is need because 
> date may be blank.
> 
> WDYT?

I made a little error in my change, it simply needs an "else value =
null" added. I'll fix it after the code freeze.

-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]                          [EMAIL PROTECTED]

Reply via email to