Problems Upating TexBox via script in a repeating section

D

Daniel

I'm developing a form where I need to calculate Date diferences (StartDate -
EndDate), at this time I have working the programming calculations but have
some problems getting/udating information from TextBoxes in a Repeting
Section.

My text boxes are: StartDate, Endate and Results, I also have a "Validate"
button that start all the calculations for date diferences. My problem is
that all works fine this works fine the first time, with the firts instance
field in the repeating section, but if I insert a new instance, then the
Result TexBox never get the results, this because the code always refers to
the first TexBox controls on the first instance of the repetaing section.

I'm using/referencing the TextBoxObjects as follows:

var Results =
XDocument.DOM.documentElement.selectSingleNode("my:Request/my:ContractProfile/my:Results");

var StartDate =
XDocument.DOM.documentElement.selectSingleNode("my:Request/my:ContractProfile/my:StartDate");

var EndDate =
XDocument.DOM.documentElement.selectSingleNode("my:Request/my:ContractProfile/my:EndDate");

Later Calculate the Differences, but Result.tetxt is always updated with the
firts instance in the repetaing section.

Results.text= GetDateDifferences(StartDate,EndDate);


Analyzing the code I can see that I'm woking with a reference to the
DatePickers and TexBox control, but I don't know why Is always refrencing the
first intance and what i need to do to developa code full-functional for all
posible instances in the repeating sections.

I will appreciate any ideas about how to resolve this.

Daniel
 
S

S.Y.M. Wong-A-Ton

A repeating section is a group that repeats. You have StartDate, EndDate, and
Results in each group. You need to loop through all the groups(=nodes) in
your repeating section (the group would be my:ContractProfile in your case),
retrieve its child nodes (my:StartDate, my:EndDate, and my:Results in your
case), perform the date calculations, and then update the Results node all
within the same group.
 

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

Similar Threads


Top