Yes, the problem was that the field was bound to the main datasource. Thanks a lot for your help!!
Now i headed an new problem, how can i change the value in that field after i have changed the binding? My code for this is:
XDocument.DOM.setProperty("SelectionNamespaces", 'xmlns:tns="http://strandinoment.com/webservices/" xmlns:dfs="http://schemas.microsoft.com/office/infopath/2003/dataFormSolution"');
var currentUserDep = XDocument.DOM.selectSingleNode("//dfs:dataFields//tns:GetMyInfoResponse//GetMyInfoResult");
var myDep = currentUserDep.text;
if(currentUserDep.text.charAt(0) == '<'){
var string = currentUserDep.text;
var start = string.indexOf("Department",0);
var end = string.indexOf("]",start+21);
myDep = string.substring(start+21,end);
}
else myDep = currentUserDep.text;
currentUserDep.text = myDep;
But i get the error "Object required". It seems that the code can not find the right node. Is that right? How do i solve this?