Merging forms

P

Paul Aner

Hi*,

since Frank was helping me solving my first issue ther came up
another one right now:

Within the template of the form from my Sharepoint library there is
the following code:

function msoxd_my_ArtikelNummer::OnAfterChange(eventObj) {
var txtArticleTitle;
var txtArticleNumber;
var flArticlePrice;
var currentNodeValue = eventObj.Site.nodeTypedValue;
var domArticleList = XDocument.GetDOM("Artikelliste");
allArticles = domArticleList.firstChild.firstChild.childNodes;
for (i=0; i < allArticles.length; i++) {
oneArticleElement = allArticles.item(i);
if(oneArticleElement.attributes != null) {
if (oneArticleElement.attributes(1).text == currentNodeValue) {
txtArticleTitle = oneArticleElement.attributes(0).text;
txtArticleNumber = oneArticleElement.attributes(1).text;
flArticlePrice = parseFloat(oneArticleElement.attributes(2).text);

break;
}

}
}

eventObj.Site.parentNode.childNodes.item(3).nodeTypedValue =
txtArticleTitle;
oNode = eventObj.Site.parentNode.childNodes.item(5);
if (null != oNode.getAttribute("xsi:nil") ) {
oNode.removeAttribute("xsi:nil");
}
eventObj.Site.parentNode.childNodes.item(5).nodeTypedValue =
flArticlePrice;

callRowSum(eventObj);

calculateOrderSum();
}




Filling out the form works fine, but merging makes some trouble: When
merging forms, the indices od my repeating table seem to be "shuffeled".
Within a single form in "eventObj.Site.parentNode.childNodes.item(5)"
there is the value of "flArticePrice", but when merging at least two
forms the index (5) seems to be incremented by two, because within the
merged document there is the value of item(3) being put into the value
of item(5).

How do I have to handle this?

Any ideas?

Bye and thanks a lot,

Paul
 
P

Paul Aner

I solved the problem with these shuffled merged form. Instead of
using code like

eventObj.Site.parentNode.childNodes.item(3).nodeTypedValue =
txtArticleTitle;

with a fixed value for the item-index I am using a for-loop,
now, to walk through the nodes and catch the only one I
need by it's name. See the following code:

for (i = 0; i < allNodes.length; i++) {
oneItem = allNodes.item(i);
if (oneItem.nodeName == "my:EPreis") {
txtArticlePrice = oneItem.nodeTypedValue;
} // if
} // for

When I merge forms with this code everything seems to work fine.

Bye,
Paul
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top