Set condition based on repeating section, how do you know which fi

J

JohnG

I'm want to set a submit option that looks at a field, if it matches a name
the form is sent to that person via email.

The problem is that this section is in a repeating section, so I can't just
choose "Field 8" since I don't know what that field will be called in a
repeating section!

Since the first of the repeating sections is revealed in design mode the
field I want is field 8, but when the user repeats the section to fill in
another name I have no idea what the NEXT name field will be designated as so
no way to set a condition to it.

Hope that made sense.
 
B

Ben Walters

Hey John
You have a couple of options here,
1: You could put a button to fire off the submit action in your repeating
section,
I'm not sure what affect this would have on the form design but if a button
is clicked in the repeating section then any field you reference in that
section will be in context to the row where the button was clicked, This
does mean however that you will have button for each row in your repeating
section.

2: Look at using managed code to find the field you want,
Rather than running rules on your button control you could put some code
behind that looped through each node in the repeating section until it found
one that matched, when the matched value is found then you could submit your
form via email. a basic code sample of this is below


public void CTRL4_5_Clicked(object sender, ClickedEventArgs e)
{
XPathNavigator Mainds = this.MainDataSource.CreateNavigator();
XPathNodeIterator MyRepeatingSection =
Mainds.Select("/my:myFields/my:group1/my:group2", this.NamespaceManager);

foreach (XPathNavigator Section in MyRepeatingSection)
{
if (Section.SelectSingleNode("my:Field8",
this.NamespaceManager).Value == "MyName")
{
this.Submit();
}
}
}

If you need more details on how to construct your xpath query I would
suggest the following article always helps me out when i'm having syntax
issues http://msdn.microsoft.com/en-us/library/ms256086.aspx

Hope this helps

Cheers
Ben Walters
 

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