You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Marcin Okraszewski <ok...@o2.pl> on 2004/06/15 22:16:22 UTC

[Woody] Integers in dynamic selection list are localized (BUG?)

Hi,
I have a multivalue field. Its values are integers, but some of them are 
 > 1000. The selection list is dynamically generated. After woody 
transformer, values are converted into human readable form, so that eg. 
"1000" is changed into "1 000". I tried with <wd:convertor> in model, 
but it doesn't help, and in dynamic list causes null pointer exception. 
Of course numbers in generated selection list are without spaces. This 
also causes that two-sided selection list also doesn't work. I'm using 
Cocoon 2.1.4-dev.

Did any one had such problems? What is the solution? Model, selection 
lists, etc are below.

Regards,
Marcin Okraszewski

MODEL
-----

<wd:multivaluefield id="teachers">
   <wd:label><i18n:text>teachers</i18n:text></wd:label>
   <wd:datatype base="integer"/>
   <wd:selection-list 
src="cocoon://resources/common/form/user_full_list.xsp" dynamic="true"/>
</wd:multivaluefield>



GENERATED SELECTION LIST (just a part)
--------------------------------------

<wd:selection-list>
   <wd:item value="297">
     <wd:label>Adamczyk Arnold</wd:label>
   </wd:item>

   <wd:item value="1075">
     <wd:label>Adamski Władysław</wd:label>
   </wd:item>

   <wd:item value="854">
     <wd:label>Apel-Chylińska Krzysztofa</wd:label>
   </wd:item>

   ...
</wd:selection-list>


AFTER WOODY TRANSFORMER (notice second item: "1 075")
--------------------------------------------

<wi:multivaluefield id="forms.0.teachers">
   <wi:values>
     <wi:value>1053</wi:value>
     <wi:value>297</wi:value>
   </wi:values>
   <wi:label>prowadzący</wi:label>

   <wi:selection-list>
     <wi:item value="297">
       <wi:label>Adamczyk Arnold</wi:label>
     </wi:item>

     <wi:item value="1 075">
       <wi:label>Adamski Władysław</wi:label>
     </wi:item>

     <wi:item value="854">
       <wi:label>Apel-Chylińska Krzysztofa</wi:label>
     </wi:item>

     ...
</wi:multivaluefield>

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


Re: [Woody] Integers in dynamic selection list are localized (BUG?)

Posted by Marcin Okraszewski <ok...@o2.pl>.
Hi,
Plain convertor worked as I wanted when it was in model. Previously I 
tried with formatting convertors and giving pattern like "#####0", but 
it didn't result as I expected.

Thanks for help.
Marcin Okraszewski


>> I tried with <wd:convertor> in model, 
>>but it doesn't help,
> 
> 
> it would help to use a non-locale sensitive convertor (the "plain"
> types).


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


Re: [Woody] Integers in dynamic selection list are localized (BUG?)

Posted by Bruno Dumon <br...@outerthought.org>.
On Tue, 2004-06-15 at 22:16, Marcin Okraszewski wrote:
> Hi,
> I have a multivalue field. Its values are integers, but some of them are 
>  > 1000. The selection list is dynamically generated. After woody 
> transformer, values are converted into human readable form, so that eg. 
> "1000" is changed into "1 000".

Correct, that's on purpose.

>  I tried with <wd:convertor> in model, 
> but it doesn't help,

it would help to use a non-locale sensitive convertor (the "plain"
types).

>  and in dynamic list causes null pointer exception. 
> Of course numbers in generated selection list are without spaces. This 
> also causes that two-sided selection list also doesn't work. I'm using 
> Cocoon 2.1.4-dev.
> 
> Did any one had such problems? What is the solution? Model, selection 
> lists, etc are below.

Make sure that the WoodyTemplateTransformer uses the same locale as
you're using for processing the form.

The locale can be specified in multiple ways, one possibility is to set
it as a request attribute named locale. For the form processing IIRC it
can be specified by setting it on the form.locale attribute.

So:

var locale = Packages.java.util.Locale.US;
form.locale = locale;
cocoon.request.setAttribute("locale", locale);

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