Cant get code to work

T

Tag

OK, my problem is that im including a check that goes through a
repeating section and makes sure only one of these sections has a
checkbox titled primary contact selected, and if it finds more than
one, to reset the others to no

var nodeSelTextContact = XDocument.DOM.selectNodes("//my:Contact");
var count = 0;
var selectedNode;

for(var i=0; i< nodeSelTextContact.length;i++)
{
if(nodeSelTextContact.selectSingleNode("my:primaryContact").text
== "1")
{
selectedNode =
nodeSelTextContact.selectSingleNode("my:primaryContact");
count++;
}
if(count >= 1)
{
for(var k=0; k < nodeSelTextContact.length; k++)
{
nodeSelTextContact[k].selectSingleNode("my:primaryContact").text
== "2";
}

selectedNode.text = "1";
return;
}


any idea? Whats happening right now, is it detects the yes, and goes to
the second loop, but doesnt set the values to 2
 

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