After a user enters several fields of data into a repeating group, I'd like
to traverse the collection of values and evaluate them using conditional
statements. I don't have Visual Studio.Net, so I need to work in Jscript.
For example, if there's a textbox with a field name Field10 in a repeating
group, and a user enters Schnauzer, German Shepherd, and then Schnauzer a
second time, I want to run some code in the OnAfterChange event (I think) to
evaluate each of the entries the user made. If I find a duplicate, I want to
clear that instance and display a message to the user "You already chose that
value". Can I do this using the J scripting language? How can I loop through
the values that a user entered in a field in a repeating group (all values
were entered into instances of a field that I only know as Field10). Thanks
for any advice provided.
Greg Collins [InfoPath MVP] - 23 Mar 2006 19:49 GMT
You will need to use XDocument.DOM.selectNodes("{MY XPATH HERE}/Field10");
Then you loop through the nodes that were found and if there is 2 more values matching what was just typed in you give your message.
You might want to use the OnBeforeChange event handler for this instead.

Signature
Greg Collins [InfoPath MVP]
Visit http://www.InfoPathDev.com
After a user enters several fields of data into a repeating group, I'd like
to traverse the collection of values and evaluate them using conditional
statements. I don't have Visual Studio.Net, so I need to work in Jscript.
For example, if there's a textbox with a field name Field10 in a repeating
group, and a user enters Schnauzer, German Shepherd, and then Schnauzer a
second time, I want to run some code in the OnAfterChange event (I think) to
evaluate each of the entries the user made. If I find a duplicate, I want to
clear that instance and display a message to the user "You already chose that
value". Can I do this using the J scripting language? How can I loop through
the values that a user entered in a field in a repeating group (all values
were entered into instances of a field that I only know as Field10). Thanks
for any advice provided.
_bizon - 23 Mar 2006 20:14 GMT
1. force user to enter data in field10 using the "Cannot be blank" validation
or similar;
2. also, you can disable the repeating table ability to add rows using
Conditional Formatting (if field10 is blank, "Don't allow users to insert or
delete this control")
3. in Data Validation for field10 use the following expression: . =
../preceding-sibling::*/my:field1, which will invalidate that field (a red
border will notify the user), thus the form won't submit successfully...

Signature
Liviu
> After a user enters several fields of data into a repeating group, I'd like
> to traverse the collection of values and evaluate them using conditional
[quoted text clipped - 8 lines]
> were entered into instances of a field that I only know as Field10). Thanks
> for any advice provided.