You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by dtrhieu <dt...@gmail.com> on 2007/10/30 10:03:27 UTC

[Cocoon 2.1 + binding] Cannot convert float to integer

Hello,
I have a form in which I use some fields in floating number (base="double").
When I trigger the save function (form.save(bindData)), all numbers after
the floating point have disappeared.

(example: 12.34 become 12.0)

Here's my definition file:

<fd:form xmlns:fd="http://apache.org/cocoon/forms/1.0#definition"
         xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
  <fd:widgets>
    <fd:repeater id="case" orderable="true">
      <fd:widgets>
       
        <fd:output id="CaseID">
          <fd:label>ID</fd:label>
          <fd:datatype base="integer"/>
        </fd:output>
        
        <fd:field id="a">
          <fd:label>Value of a</fd:label>
          <fd:hint>Value of a</fd:hint>
          <fd:datatype base="double"/>
        </fd:field>
        
        <fd:field id="b">
          <fd:label>Value of b</fd:label>
          <fd:hint>Value of b</fd:hint>
          <fd:datatype base="double"/>
        </fd:field>
        
        <fd:field id="c">
          <fd:label>Value of c</fd:label>
          <fd:hint>Value of c</fd:hint>
          <fd:datatype base="double"/>
        </fd:field>        

      </fd:widgets>
    </fd:repeater>
  </fd:widgets>
</fd:form>

And here is my binding file:

<fb:context xmlns:fb="http://apache.org/cocoon/forms/1.0#binding" path=".">
  <fb:simple-repeater id="case" parent-path="cases" row-path="case">
    <fb:value id="CaseID" path="@id"/>
    <fb:value id="a" path="a"/>
    <fb:value id="b" path="b"/>
    <fb:value id="c" path="c"/>
  </fb:simple-repeater>
</fb:context>

Anyone has an idea of this problem ? 
Thanks in advance

Dang Trong Hieu
-- 
View this message in context: http://www.nabble.com/-Cocoon-2.1-%2B-binding--Cannot-convert-float-to-integer-tf4717212.html#a13484730
Sent from the Cocoon - Users mailing list archive at Nabble.com.


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


Re: [Cocoon 2.1 + binding] Cannot convert float to integer

Posted by Antonio Gallardo <ag...@agssa.net>.
Hi Dang,


Check the Locale configuration of the server. Seems it has to do with 
the decimal separator used: a comma (,) or a point (.).

Best Regards,

Antonio Gallardo.

dtrhieu escribió:
> Sorry for the error in the subject, my problem is that Cocoon remove all
> numbers after the point.
>
>
> dtrhieu wrote:
>   
>> Hello,
>> I have a form in which I use some fields in floating number
>> (base="double").
>> When I trigger the save function (form.save(bindData)), all numbers after
>> the floating point have disappeared.
>>
>> (example: 12.34 become 12.0)
>>
>> Here's my definition file:
>>
>> <fd:form xmlns:fd="http://apache.org/cocoon/forms/1.0#definition"
>>          xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
>>   <fd:widgets>
>>     <fd:repeater id="case" orderable="true">
>>       <fd:widgets>
>>        
>>         <fd:output id="CaseID">
>>           <fd:label>ID</fd:label>
>>           <fd:datatype base="integer"/>
>>         </fd:output>
>>         
>>         <fd:field id="a">
>>           <fd:label>Value of a</fd:label>
>>           <fd:hint>Value of a</fd:hint>
>>           <fd:datatype base="double"/>
>>         </fd:field>
>>         
>>         <fd:field id="b">
>>           <fd:label>Value of b</fd:label>
>>           <fd:hint>Value of b</fd:hint>
>>           <fd:datatype base="double"/>
>>         </fd:field>
>>         
>>         <fd:field id="c">
>>           <fd:label>Value of c</fd:label>
>>           <fd:hint>Value of c</fd:hint>
>>           <fd:datatype base="double"/>
>>         </fd:field>        
>>
>>       </fd:widgets>
>>     </fd:repeater>
>>   </fd:widgets>
>> </fd:form>
>>
>> And here is my binding file:
>>
>> <fb:context xmlns:fb="http://apache.org/cocoon/forms/1.0#binding"
>> path=".">
>>   <fb:simple-repeater id="case" parent-path="cases" row-path="case">
>>     <fb:value id="CaseID" path="@id"/>
>>     <fb:value id="a" path="a"/>
>>     <fb:value id="b" path="b"/>
>>     <fb:value id="c" path="c"/>
>>   </fb:simple-repeater>
>> </fb:context>
>>
>> Anyone has an idea of this problem ? 
>> Thanks in advance
>>
>> Dang Trong Hieu
>>
>>     
>
>   


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


Re: [Cocoon 2.1 + binding] Cannot convert float to integer

Posted by dtrhieu <dt...@gmail.com>.
Sorry for the error in the subject, my problem is that Cocoon remove all
numbers after the point.


dtrhieu wrote:
> 
> Hello,
> I have a form in which I use some fields in floating number
> (base="double").
> When I trigger the save function (form.save(bindData)), all numbers after
> the floating point have disappeared.
> 
> (example: 12.34 become 12.0)
> 
> Here's my definition file:
> 
> <fd:form xmlns:fd="http://apache.org/cocoon/forms/1.0#definition"
>          xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
>   <fd:widgets>
>     <fd:repeater id="case" orderable="true">
>       <fd:widgets>
>        
>         <fd:output id="CaseID">
>           <fd:label>ID</fd:label>
>           <fd:datatype base="integer"/>
>         </fd:output>
>         
>         <fd:field id="a">
>           <fd:label>Value of a</fd:label>
>           <fd:hint>Value of a</fd:hint>
>           <fd:datatype base="double"/>
>         </fd:field>
>         
>         <fd:field id="b">
>           <fd:label>Value of b</fd:label>
>           <fd:hint>Value of b</fd:hint>
>           <fd:datatype base="double"/>
>         </fd:field>
>         
>         <fd:field id="c">
>           <fd:label>Value of c</fd:label>
>           <fd:hint>Value of c</fd:hint>
>           <fd:datatype base="double"/>
>         </fd:field>        
> 
>       </fd:widgets>
>     </fd:repeater>
>   </fd:widgets>
> </fd:form>
> 
> And here is my binding file:
> 
> <fb:context xmlns:fb="http://apache.org/cocoon/forms/1.0#binding"
> path=".">
>   <fb:simple-repeater id="case" parent-path="cases" row-path="case">
>     <fb:value id="CaseID" path="@id"/>
>     <fb:value id="a" path="a"/>
>     <fb:value id="b" path="b"/>
>     <fb:value id="c" path="c"/>
>   </fb:simple-repeater>
> </fb:context>
> 
> Anyone has an idea of this problem ? 
> Thanks in advance
> 
> Dang Trong Hieu
> 

-- 
View this message in context: http://www.nabble.com/-Cocoon-2.1-%2B-binding--Cannot-convert-float-to-integer-tf4717212.html#a13484731
Sent from the Cocoon - Users mailing list archive at Nabble.com.


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