Multiple selection on K2listbox

  • 6 February 2006
  • 1 reply
  • 3 views

Badge +2
Hi there,

I need to save the multiple selections of the listbox to XMLFields and then it should load the selections and the opriginal data back into the listbox on the next form. The listbox can potentially have hundreds of entries.

At this stage I only get it to save the selected value of the listbox to the XML field and no other data like the text of the field or the index. It also only saves the selected data.

How should my XML schema look like and what properties should I set on the Listbox to get this right please. Is this at all possible? If not how should I approach this problem?

1 reply

Badge +4
I included a picture of the K2 Xml field. I found that you must include the Root node in the Xml field. When you create the Xml field in the K2.net® Studio, you must remember to just add one element and link the listbox XPath to that element. All the xml will be available in the xml as a string. The K2 xml field must be of type string.

K2.net Listbox Limitations:
1. SmartForms do not support ANY attributes. Will not display any attributes when selecting XML Datafields.
2. When viewing XML Datafields from Workspace, some values will be encoded and others not. This is decided by the XML Dom. To view values, attach XSLT, so XML will be rendered correctly.
3. XMLTargetNamespace, XMLIndex and NodeOrder are internal properties that must not change. This will affect the SmartForms ability to execute as expected.
4. Bind and GetData are internal methods that must rather not be used. This will affect the SmartForms ability to execute as expected.
5. There is NO Data Type validation when using the Data properties.
6. When setting initial values for properties in runtime, remember to use the Page_PreRender event or the Page_Load event.
7. When setting databindings or populating lists in runtime, do this in the Page_Init event.
8. The K2Listbox control sets DataField to the VALUE and not the TEXT of the selected item.
9. The K2Listbox control can READ and WRITE values from and to DataFields.
10. The XML pointed to, cannot be a repeating section inside another repeating section, as the control will not know to which section to write data to.

Reply