You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Bart Molenkamp <b....@bizzdesign.nl> on 2004/09/24 14:30:21 UTC

Embedded JavaScript in form definition file to create items for selection list

Hi all,

Would it possible, or a good idea to be able to build a selection list
with some embedded javascript code? E.g.

<fd:selection-list type="javascript" value-path="value"
label-path="label">
  var data = new Object();

  data.cityList = new Array(2);
  data.cityList[0] = {value:"AL", label:"Alabama"};
  data.cityList[1] = {value:"AK", label:"Alaska"};  

  return data;
</fd:selection-list>

The definition already can have embedded JavaScript for event handling,
so why not here?

Bart.

Re: Embedded JavaScript in form definition file to create items for selection list

Posted by Sylvain Wallez <sy...@apache.org>.
Bart Molenkamp wrote:

>Hi all,
>
>Would it possible, or a good idea to be able to build a selection list
>with some embedded javascript code? E.g.
>
><fd:selection-list type="javascript" value-path="value"
>label-path="label">
>  var data = new Object();
>
>  data.cityList = new Array(2);
>  data.cityList[0] = {value:"AL", label:"Alabama"};
>  data.cityList[1] = {value:"AK", label:"Alaska"};  
>
>  return data;
></fd:selection-list>
>
>The definition already can have embedded JavaScript for event handling,
>so why not here?
>  
>

Have you considered <fd:selection-list type="flowjxpath"> ?

Sylvain

-- 
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }