cancel
Showing results for 
Search instead for 
Did you mean: 

XSD nested/linked selection list / combobox

d_segato
Champ in-the-making
Champ in-the-making
[size=150]this is what i want to achieve:[/size]

2 (or more) combobox linked togheter
examples:

section -> subsection
category -> subcategory
state -> city
menu1 -> menu2

pratical example:

state list: Italy, France, ….

city list: Italy = { Rome, Milan, …. }, France = { Paris, …. }

a single combobox could be obtained by set a restriction list on a xs:normalizedString element.
I would like to link two list

is there a way to achieve this?
thanks
4 REPLIES 4

pmonks
Star Contributor
Star Contributor
This would require a custom XForm widget (http://wiki.alfresco.com/wiki/Creating_XForms_Widgets) that detects (or is notified of) changes in the parent dropdown, and recalculates the values to be displayed in the child dropdown (perhaps by calling a Web Script or some other external service - it depends how much data in total there is and whether it can be filtered solely in the browser).

Because Web Forms are basically just DOJO forms (http://dojotoolkit.org/), a good working knowledge of DOJO would be beneficial.

Cheers,
Peter

d_segato
Champ in-the-making
Champ in-the-making
Hi pmonks,

thanks for you reply.

I've already thinked about this.

But i was trying to find a way define it directly from the XSD

It's ok to me to create a new widget. But then what's the best way to "pass" the parent-child relationship and the datas(or where to find the datas) from the XSD to the widget?

i can create 2 custom widget that are linked between togheter by a parent-child relationship but then i had to create new custom widgets (and reboot alfresco) for every new dropdown

Can you advice a way to pass this informations from XSD to the Widget without defining them in the web-client-config-wcm.xml or inside the javascript?

Thank you very much

rsulliv1
Champ in-the-making
Champ in-the-making
Have you implemented anything or started working on your widget?

I'd like to see what documentation sources you used to get to your solution.

There aren't any alfresco dependent widget examples out there at all (at least none that I've found yet). Any information you can provide will benefit everyone!

d_segato
Champ in-the-making
Champ in-the-making
We didn't go on with this because we changed the way things were done.
The reply I can give you is: you must create a new custom widget and play with javascript.

You'll need a way to "link" the parent and the child select box widget.
A way is:
  1. put 3 configuration options in your widget: parentWidgetId, widgetClassId, childClassId.

  2. when you build the widget through javascript assing the widgetClassId to it and use parent/child ones to "find" the other two.

  3. when a select box change it's value if it has a childId use it to notify the child

  4. if you receive a notification use your parentId to get the parent value (or pass it with the previous notification, or whatever)

  5. update the options of your select box in any way you want. Ajax call, XSD values manipulations and so on…
Good luck and if you manage to create a widget think about making it public.
If I'll ever write a widget like that (in my spare time) I'll make it public and I'll say that here.

Good luck and regards,
Daniele