cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan.Haeberl...@sic.ch
Subject Antwort: Re: formatting problems with dates in flow-jxpath selection-list
Date Thu, 20 Jul 2006 10:11:53 GMT
Hi Mark

I finally used the jxpath selection-list with datatype='string' for both 
label and value. I changed my flowscript to:

var formatter = new FastDateFormat.getInstance("dd.MM.yyyy"); 
var elementLabel = null;
var elementValue = null;
 
max = g_orderForm.getWishDate().size();
g_listData.wishDate = new Array(max);
iter = g_orderForm.getWishDate().iterator();
i = 0; 
 
while(iter.hasNext()) {
        element = iter.next();
        elementLabel = formatter.format(element).toString();
        elementValue = element.toString(); 
        g_listData.wishDate[i] = {value:elementValue, label:elementLabel};
        i++;
}

It works perfect! Thank you for the hint!

Regards, Stefan





Mark Lundquist <ml@wrinkledog.com> 
20.07.2006 00:18
Bitte antworten an
users@cocoon.apache.org


An
users@cocoon.apache.org
Kopie

Thema
Re: formatting problems with dates in flow-jxpath selection-list







On Jul 19, 2006, at 8:54 AM, Simone Gianni wrote:

> As you can see you are using the Date object both as value and as 
> label,
> the convertor only works on the value, you have to format the label
> yourself in javascript. This can be accomplished in many ways, I can't
> remember which facilities javascript offers

I don't think it does... AFAIK you have to use Java.

>  but alternatively you can
> use the common java SimpleDateFormat simply instantiating it with var
> formatter = new Packages.java.text.SimpleDateFormat('dd.MM.yy'); and
> then using as it java, formatter.format(element) IIRC.

I default to FastDateFormat from Commons:
                 
http://jakarta.apache.org/commons/lang/api/org/apache/commons/lang/ 
time/FastDateFormat.html

:-)
?ml?


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



Mime
View raw message