XForms, adding new items to a select1 xform control

Vote:
 

 

Hi

Im trying to add new items to a select1 Xform control in codebehind. It works well getting the new item in to the select1 box, with both Value and Label.

Having selected the new value and submitting the form the new value (item) is not present in the FormData XML. Selecting one of the predefined items works.

ArrayList formControls = form.ExtractXFormControls(); foreach (XFormControlBase control in formControls) { Select1 EPIselect = control as Select1; if (EPIselect != null) if (EPIselect.Reference == "ToEmailSelect") { SelectItem si = new SelectItem(); si.Label = "testLabel"; si.Value ="testValue"; EPIselect.Choices.Add(si); } }

Is this a dead-end? Is Xform comparing the selected index with database data? And when adding new items they exceeds the index?

Has any one tried doing something like this?

Janne Saare

#19890
May 13, 2008 16:05
Vote:
 

Hi,

How did you solve this issue?

I had to use a workaround with jQuery and FormData.SetValue to get the selected option into the form data.. 

Regards,

Peter

#26000
Nov 17, 2008 11:26