Try our conversational search powered by Generative AI!

XForms, adding new items to a select1 xform control




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

May 13, 2008 16:05


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.. 



Nov 17, 2008 11:26
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.