Hello,
I have a repeating table containing a text box and a combobox.
What i want : user enters value in text box, web service returns values according to value in text box, and combobox is filled with values returned by web service.
It works fine for the first row, by linking data of my combobox to the web service (configured into Data properties). The problem is that, when there are several rows, all comboxes are updated with the last values returned by web service (and not only the one in the same row).
I found a lot of things in InfopathDev around this problem, but i can't find a response to my problem (or maybe i don't understand it).
Can i do what i want without code?
I think it's not possible, so i try to achieve it by code, and want to add items in combobox programmatically.
Once again, i found a lot of example, but can't make it works : UI never displays the node i add. But if i save the form as XML, i found them.
Here's my code, launched in OnBeforeChange event of the text box:
function insertChildsFromService(psService) {
XDocument.UI.Alert("insertChildsFromService");
var index;
// get results from service
var theDataObject = XDocument.DataObjects.Item(psService);
theDataObject.DOM.setProperty("SelectionNamespaces",
'xmlns:dfs="http://schemas.microsoft.com/office/infopath/2003/dataFormSolution" ' +
'xmlns:ns="..."');
var nodesService = theDataObject.DOM.selectNodes("/dfs:myFields/dfs:dataFields/ns:getValuesResponse");
// get parent to modify
var nodeParent = XDocument.DOM.selectSingleNode("/ns2:documentum/documentum:fields/documentum:doc_child_lda");
var nodeOption = XDocument.DOM.selectSingleNode("/ns2:documentum/documentum:fields/documentum:doc_child_lda/documentum:child_c_language");
XDocument.View.DisableAutoUpdate();
if (nodesService.length > 0) {
for (index = 0; index < nodesService.length; index++) {
var nodeClone = nodeOption.cloneNode(true);
nodeClone.text = nodesService[index].text;
nodeParent.appendChild(nodeClone);
}
}
XDocument.View.EnableAutoUpdate();
XDocument.View.ForceUpdate();
} //insertChilds
Does anyone have a tip?
I think i don't understand something...
I'm using InfoPath 2003 and jscript.
Thank you