Change value in repeating tables

B

BethB

I have a repeating table that has 2 drop downs - the second one is dependant
on the first for the values.
The problem is that if I change the first one, I need the second one to null
out any value - as well as other fields in the table
I have been able to do this with this code at the 'onAfterChange' Event
(This is for the first field only - the actual code just repeats this over
and over with a different field name)
Set objTask =
XDocument.DOM.selectSingleNode("/dfs:myFields/dfs:dataFields/d:tblReport/d:tblTime/@TaskName")
objTask.text = ""

The problem is that when I add addtional rows and this code is forced to run
when the first listbox value is changed, It also changes the values in other
rows.

I assume that I need to use the current() function, but I cannot seem to get
the syntax right.

Any help is appreciated......Beth
 
B

BethB

I cannot seem to get anything in the article to run
When I enter XDocument.UI.Alert(eventObj.Source.nodeName); - I get an
expected end of statement error.

When I try to enter
objTask = eventObj.Source.parentNode.selectSingleNode("../TaskName") I get
an expected object error.
I am just as lost as I was before - Any and all help is appreciated.

Beth
 
B

BethB

I am sorry - I did not mean to sound ungrateful - I am just very frustrated.
It seems to me that it should be very easy to change the value of a field in
the current row of a repeating table without always changing the first row
instead.
 
S

S.Y.M. Wong-A-Ton

Correct the XPath expression in the last statement and the error should be
resolved. TaskName is an attribute (as in your first post) and not an element
as you've defined it now. Add the @ sign back. And you're on the right track
trying to debug your code using alerts; not sure what's causing the error
there, though.
 
S

S.Y.M. Wong-A-Ton

I understand. No worries.

Many things that "should" be easy are fairly complex to achieve in InfoPath.
The articles I've written and write try to ease some of that pain, but they
still don't provide all the answers. They are only samples of how you might
get things that seem impossible in InfoPath done. My own time is limited, so
I cannot provide free full solutions to everyone. I've got to make a living
too. :)
 
A

ahmedakb

Hiya guys, I found a similar issue with this. I was attempting to
select other values in the same repeating table row using the
onAfterChange event of another field.

I used the following:
if (!e.Operation.Equals("Delete")
{
String str =
e.Source.parentNode.selectSingleNode("../myRepatingTable:Tax").text
}

This worked fine without any errors.

The onChangeEvents are called twice once for delete and then for
insert, the delete has the parentnode set to null.
Thats where we get the errors.
 

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