Changing the value of a secondary data source by code..

T

Tag

My problem is, i want to create a repeating table that fills with
information from our database and be able to "select" one of these to
pull more data from the database to populate the form.

I created a webservice that returns my information, and added a "fake"
variable called checkbox with a boolean value type. What i was hoping
is that i could select one of the returned results and then by code
have the other checkboxes automaticaly set to FALSE so that i never
have more than one checkbox selected (because the customer should only
be selecting one box anyway, but i want this "check" to be in there
anyway

this is what i coded:

function
msoxd_tns_BusinessEntityReturn__Checkbox::OnAfterChange(eventObj)
{
if (eventObj.NewValue == "TRUE")
{
var nodeSelTextContact =
XDocument.DOM.selectNodes("/dfs:myFields/dfs:dataFields/tns:BusinessEntityReturnResponse/tns:BusinessEntityReturnResult/tns:BusinessEntity");
var selectedNode = eventObj.Site;

for(var i = 0; i < nodeSelTextContact.length; i++)
{
if(nodeSelTextContact.selectSingleNode("/dfs:myFields/dfs:dataFields/tns:BusinessEntityReturnResponse/tns:BusinessEntityReturnResult/tns:BusinessEntity/tns:Checkbox")
!= selectedNode)
{
nodeSelTextContact.selectSingleNode("/dfs:myFields/dfs:dataFields/tns:BusinessEntityReturnResponse/tns:BusinessEntityReturnResult/tns:BusinessEntity/tns:Checkbox").text
= "FALSE";
}
}

}

}

however this doesnt seem to be working for me, any ideas or is this
possible?
 
S

S.Y.M. Wong-A-Ton

Let me rephrase your question to see if I understood it correctly: You have a
repeating table. One of the columns of the repeating table is a checkbox. You
want to be able to select a checkbox in one row and have all the other
checkboxes in the other rows deselected through code? If so, yes, this should
be feasible in InfoPath.

What is your code currently doing? Any errors? It's best to try debugging it
(using XDocument.Alert) at each line to see whether it is doing what you're
expecting it to do.
 
T

Tag

That is exactly correct and what im trying to do, however, currently my
code doesnt do anything


S.Y.M. Wong-A-Ton said:
Sorry, made a mistake... it's XDocument.UI.Alert.
---
S.Y.M. Wong-A-Ton


Tag said:
My problem is, i want to create a repeating table that fills with
information from our database and be able to "select" one of these to
pull more data from the database to populate the form.

I created a webservice that returns my information, and added a "fake"
variable called checkbox with a boolean value type. What i was hoping
is that i could select one of the returned results and then by code
have the other checkboxes automaticaly set to FALSE so that i never
have more than one checkbox selected (because the customer should only
be selecting one box anyway, but i want this "check" to be in there
anyway

this is what i coded:

function
msoxd_tns_BusinessEntityReturn__Checkbox::OnAfterChange(eventObj)
{
if (eventObj.NewValue == "TRUE")
{
var nodeSelTextContact =
XDocument.DOM.selectNodes("/dfs:myFields/dfs:dataFields/tns:BusinessEntityReturnResponse/tns:BusinessEntityReturnResult/tns:BusinessEntity");
var selectedNode = eventObj.Site;

for(var i = 0; i < nodeSelTextContact.length; i++)
{
if(nodeSelTextContact.selectSingleNode("/dfs:myFields/dfs:dataFields/tns:BusinessEntityReturnResponse/tns:BusinessEntityReturnResult/tns:BusinessEntity/tns:Checkbox")
!= selectedNode)
{
nodeSelTextContact.selectSingleNode("/dfs:myFields/dfs:dataFields/tns:BusinessEntityReturnResponse/tns:BusinessEntityReturnResult/tns:BusinessEntity/tns:Checkbox").text
= "FALSE";
}
}

}

}

however this doesnt seem to be working for me, any ideas or is this
possible?
 

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