Search This Blog

Thursday, September 9, 2010

InfoPath Tip: Working with radio buttons and check boxes

1. This is how form with controls will look like.
clip_image001
Fig 1: Form
2. Add conditional formatting to Section 1 to hide it when Checkbox 1 is checked.
clip_image002
Fig 2: Conditional formatting for Section 1
3. Add conditional formatting to Section 2 to hide it when Checkbox 2 is checked.
4. Add rule to Option 1. By default, the value of Option button 1 is "1" and value of option button 2 is "2". Name rule "Open Section1" and set condition:
clip_image003
Fig 3: Set condition for Rule "Open Section1"
5. After setting the condition, click "Add Action" button to add action. In the "Field", select "Checkbox1" then click the "fx" button to add formula.
clip_image004
Fig 4: Add Action
6. Use "Insert Function" button to add "boolean" function or write it directly in the formula box. Click "Verify Formula" button to verify the formula and then click "OK".
clip_image005
Fig 5: Add Formula
7. You need to add three more rules. The rules are shared between the two radio buttons. Rules established for any of the buttons, both buttons. Add the second rule of "Close Section 2". Set the following condition:
clip_image006
Fig 6: Set condition for rule "Close Section 2"
Add action for this rule. Select "Checkbox1" in "Field" and leave the value blank. This will uncheck the "Checkbox1".
8. Add third rule "Open Section 2" to open the section 2. Condition set: Options is equal to "2" and add the action: "CheckBox2" has a value "Boolean (" true "). Use the technique described above to add formula. Remember, the formula of writing by hand is not set the Boolean value and will be considered as plain text in InfoPath.
9. Add fourth rule "Close Section 1". Add following condition:
clip_image007
Fig 7: Set condition for rule "Close Section 1"
Add following action:
clip_image008
Fig 8: Add action
Select "CheckBox1" in the "field" and uncheck the value. This disables the "CheckBox1". Remember that the sections are associated with those checkboxes. Checking CheckBox1 display section 1 and unchecking that hides in section 1. Similarly, CheckBox2 display control section 2 and unchecking that hides in section 2.
That's all. The point, in short, is that you must set the value of the box to "blank" to disable. Setting it to "False" is not uncheck.

No comments:

Post a Comment