Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I get data from a sharepoint list as a data source. I then have a repeating table which has one of the fields as a option (radio) control. Unfortunately, when the data is repeated, it doesn't include the option control as part of the same group, so it's possible to have multiple option controls selected at the same time. Is there any way to fix this?

Here is an explanation of the problem, along with a screenshot of part of the form. Explanation of problem

This next bit of info is a representative set of data from the sharepoint list that populate the repeatable field. Representative data set

share|improve this question
    
I'm having a hard time visualizing your problem...can you provide some screenshot(s) showing the undesired behavior? –  Rob D'Oria Jul 29 '11 at 18:05
    
I was thinking that, give me a minute or two and I'll update my post. –  Vap0r Jul 29 '11 at 18:18
    
Wow, nice form! –  BGM Nov 23 '12 at 20:52
add comment

2 Answers

up vote 6 down vote accepted
+50

I have a solution (workaround).

Only thing you need to compromise on is to replace your option button with check box (but with same functionality as option button).

I hope that you have some basic skills with InfoPath rules since my solution is all rules and it is not so simple (but you asked for no code).

Step 1:

Add two new columns to source list:

IsChecked – Type: Boolean Default value: False
DummyTitle – Type: Single line of text

My source list: My source list

Step 2:

Refresh data connection to source list in InfoPath, delete option button and just leave Title (as label/calculated value or textbox) – this is setup you already have. Or recreate your repeating table from scratch.

Step 3:

Add newly created fields to repeating table. IsChecked as CheckBox, DummyTitle as TextBox.

Add one more field to your main InfoPath data – SelectedItem (to store current selection) and add it outside of repeating table as TextBox.

InfoPath design view: Design view

Step 4:

Add two rules to IsChecked CheckBox:

Rule A:

Condition: IsChecked = TRUE and DummyTitle != (not equal) Title

Action: Set a field's value: SelectedItem = Title

Rule B:

Condition: IsChecked = FALSE and DummyTitle = Title

Action: Set a field's value IsChecked = true

Note: Rule B is ensuring that check boxes in repeating table are working as option buttons. Only one can be true.

Step 5:

Add rule to DummyTitle textbox

Condition: DummyTitle != (not equal) Title and IsChecked = TRUE

Action: Set a Field's value: IsChecked = false

Step 5:

Add rule to SelectedItem textbox.

Condition: None

Action: Set filed's value DummyTitle = SelectedItem

If you followed my steps and if I didn't make any error in explanation you will now have working example of my solution.

InfoPath preview: Working example enter image description here

Note: For production solution you can hide DummyTitle.

I used MOSS 2010 platform and InfoPath 2010 (but since there is nothing so special in solution it can run on 2007). I can even send you my xsn file for reference.

I have tried to write things down as simple as possible so no additional explanation is included. Like always: I will provide more info if needed.

I haven't touched InfoPath for year so I will not exclude that there is some simpler solution.

share|improve this answer
    
Very, Very Nice! +1 –  Rob D'Oria Jul 29 '11 at 23:32
    
Wow, that's cool. I'll try it out, I won't be back at work until thursday, but I'll make sure you get your points. It'd be cool if you could make it work with option buttons, if not, I'll probably use some page-side javascript to change all checkboxes to radios. Thanks! –  Vap0r Jul 30 '11 at 12:20
    
You can use javascript if you are displaying InfoPath form in webpart on custom aspx page! Then you can also use javascript to solve your original problem. For my solution option button is not an option :) You would need to use 2 option buttons for each item so checkbox is much better solution. –  Vedran Rasol Jul 30 '11 at 22:00
    
Ahh, I'm glad you said that, I could use infopath rules to selectively hide either one or the other! –  Vap0r Aug 1 '11 at 23:21
    
Thank you so much!!!!, you are a master. –  user11443 Oct 18 '12 at 13:31
add comment

My quick answer is to hook the Change event of the radio button, write some VB or C# code to select the Xml nodes related to that field (i.e. e.Site.Select([full XPath of field])), and Set the value of all the returned nodes except the currently selected one to zero.

I'm on my phone right now, but will drop a code snippet on how to do this later if needed.

Hopefully this will at least get you started in the right direction.

share|improve this answer
    
I should've said I was looking for a solution which did not involve infopath form code-behind. Reason being is we have never been able to get even the simplest of infopath code behind forms to work on our sharepoint server. –  Vap0r Jul 29 '11 at 19:18
    
Understood. I'll noodle on it some more and see if a no-code approach comes to me. –  Rob D'Oria Jul 29 '11 at 19:21
    
I can't come up with a no-code way to do this...pretty straightforward with code, but I completely understand your concern with that approach. The only other idea I have is to present the list differently...i.e. in a dropdown list. I know it's not as visually appealing or impactful as what you've already done, but it wouldn't require any code to end up with a single selection. –  Rob D'Oria Jul 29 '11 at 21:31
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.