Hi,
I have 2 multivalue fields.
I would like to fill the second with the values of the select items in the
first one.
eg, : if my first field is like this :
- cats
- dogs
- birds
- other pets
If I select "cats" the second field should be filled with
- c1
- c2
- c3
And I I also choose dogs (I mean cat AND dogs), have
- c1
- c2
- c3
- d1
- d2
- d3
Actually, I tried to implement the same principle as in the car-selector
sample but it does not seems to work (see code below).
So, is it possible to have such a thing or should I split my form in 2
pages ?
(which is not so cool)
regards,
Stephane
/*code*/
<fd:multivaluefield id="pets">
<fd:label>Choose pet(s) : </fd:label>
<fd:datatype base="string"/>
<fd:selection-list type="flow-jxpath" list-path="pets" value-path="value"
label-path="label" dynamic="true"/>
<fd:on-value-changed>
<javascript>
var value = event.source.value;
var petListWidget = event.source.lookupWidget("../petList");
if (value != null)
{
var lp = new Packages.com.test.ListPet(value);
var listPetsSize = lp.getListPetSize();
var data = new Object();
data.lp=new Array(listPetsSize);
for( var i=0; i < listPetsSize ; i++)
{
data.wp[i] = {value: wp.getListPetValue(i-1), label:
pjt.getListPetLabel(i-1)};
}
petListWidget.setSelectionList(data.lp, "value", "label");
}
else
{
event.source.setValue(null);
petListwidget.setSelectionList(new
Packages.org.apache.cocoon.forms.datatype.EmptySelectionList("Select kind of pet
first"));
}
petListWidget.setValue(null);
</javascript>
</fd:on-value-changed>
</fd:multivaluefield>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]