Repeating Group Data

I

InfoHound

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.
 
G

Greg Collins [InfoPath MVP]

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.

--
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.
 
B

_bizon

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...
 

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