You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Derek Hohls <DH...@csir.co.za> on 2004/07/27 10:17:17 UTC

Integer formatting [was Re: Woody convertors: date formatting & decimal formatting]

Bruno

Well, not quite impossible ;-)  Here is the code I have been
using to test this problem away from "my" app.

In samples\blocks\forms\forms, I changed:
form2_model.xml to add the widget:

    <fd:field id="bignumber" required="true">
      <fd:label>Type a really big number:</fd:label>
      <fd:datatype base="integer">
        <fd:convertor type="plain"/>
      </fd:datatype>
    </fd:field>  
    
In the form2_data.xml, I added:

  <bignumber value="3456789"/>    
  
In the form2_bind_xml.xml, I added:

    <fb:value id="bignumber" path="bignumber/@value">
      <fd:convertor datatype="integer"/>
    </fb:value> 
    
In the form2_template_action.xml, I added:

        <tr>
          <td valign="top"><ft:widget-label id="bignumber"/></td>
          <td valign="top"><ft:widget id="bignumber"/></td>
        </tr>

And in the output XML file (after form submission), I now get:

<bignumber value="3,456,789" /> 


Please try this and see if you can reproduce the problem too?!

Thanks
Derek


>>> bruno@outerthought.org 2004/07/26 04:10:56 PM >>>
On Mon, 2004-07-26 at 15:04, Derek Hohls wrote:
> Bruno
> 
> Unfortunately, that still does not seem to work;
> I still get the "," separator...

quite impossible, that means the convertor isn't used. Make sure
you're
editing the correct file, and that the convertor element is located
inside the datatype element, and that it is in the correct namespace.




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


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
MailScanner thanks transtec Computers for their support.


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


Re: Integer formatting [was Re: Woody convertors: date formatting & decimal formatting]

Posted by Bruno Dumon <br...@outerthought.org>.
On Tue, 2004-07-27 at 10:17, Derek Hohls wrote:
> Bruno
> 
> Well, not quite impossible ;-)  Here is the code I have been
> using to test this problem away from "my" app.
> 
> In samples\blocks\forms\forms, I changed:
> form2_model.xml to add the widget:
> 
>     <fd:field id="bignumber" required="true">
>       <fd:label>Type a really big number:</fd:label>
>       <fd:datatype base="integer">
>         <fd:convertor type="plain"/>
>       </fd:datatype>
>     </fd:field>  
>     
> In the form2_data.xml, I added:
> 
>   <bignumber value="3456789"/>    
>   
> In the form2_bind_xml.xml, I added:
> 
>     <fb:value id="bignumber" path="bignumber/@value">
>       <fd:convertor datatype="integer"/>
>     </fb:value> 
>     
> In the form2_template_action.xml, I added:
> 
>         <tr>
>           <td valign="top"><ft:widget-label id="bignumber"/></td>
>           <td valign="top"><ft:widget id="bignumber"/></td>
>         </tr>
> 
> And in the output XML file (after form submission), I now get:
> 
> <bignumber value="3,456,789" /> 
> 
> 
> Please try this and see if you can reproduce the problem too?!

I don't even need to.

In your form you have a field holding a java.lang.Integer object. XML
can only contain text (strings), so this object needs to be converted to
a string. Since it is the binding which takes the value from the form
and puts it in the XML, it is the binding which performs this
conversion, and in order to do so, it uses the convertor specified in
the binding.

In your binding you have:

>     <fb:value id="bignumber" path="bignumber/@value">
>       <fd:convertor datatype="integer"/>
>     </fb:value> 

Properly configuring that binding should solve it. For instance, for
what you want to achieve, you can do:

>     <fb:value id="bignumber" path="bignumber/@value">
>       <fd:convertor datatype="integer" type="plain"/>
>     </fb:value> 

Hope this makes it clear.

-- 
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