Hi everyone,
I have been pulling my hair out about this for 2 weeks now and I'm getting nowhere. I hope someone can help.
I have a repeating table that has a dropdownlist in it. When the user selects an item in the list, I want to populate two other fields. One with the value (which is working fine) and the other with the display name. I need these values to post to a SQL table on submit. I wrote some code in the onchangeafter event that works for the first dropdown only. If the user adds another row it doesn't work for that row. Below is my code. I kind of understand why it isn't working (no index for the specific control) but I don't know how to make it work.
var strNewValue = XDocument.DOM.selectSingleNode("/my:ExpenseClaim/my:ExpenseItems/my:CategoryName").text;
var sCo = XDocument.DOM.selectSingleNode("/my:ExpenseClaim/my:EmployeeDetails/my:Company").text;
var sDept = XDocument.DOM.selectSingleNode("/my:ExpenseClaim/my:EmployeeDetails/my:Department").text;
var theDataObject = XDocument.DataObjects["GetCategories"];
theDataObject.DOM.selectSingleNode("//*[local-name()='Company']").text = sCo;
theDataObject.DOM.selectSingleNode("//*[local-name()='Department']").text = sDept;
theDataObject.Query();
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async = false;
xmlDoc.loadXML(theDataObject.DOM.xml);
var root = xmlDoc.getElementsByTagName("*");
var acctCode, accName;
for (var i=0; i<= (root.length - 1); i++)
{
if (root.item(i).nodeName == "AccountCode")
{
acctCode = root.item(i).text;
if (acctCode == strNewValue)
{
acctName = root.item(i+1).text;
}
}
}
I don't know what to do to make this work. I thought if I could add the code to a rule that might help but I don't know how to do that.
Since I am totally lost, very specific answers would be most helpful as all I am finding are generic "You need add code to the function on the datasource default value" answers. Makes sense, but I don't how to do that or what the code should look like.
Thanks for your patience and help.
Rhonda
[email protected]