Saturday, July 28, 2012

Toggle section from within InfoPath form

A simple way to add section toggle from within InfoPath form.
Step for creating form -

Add a new Field - HideShowButtonText, set default value to "t" without quotes

  Steps for adding button -

1. Add new button, Set the button ID to "btnToggle"



2. Set the Label to HideShowButtonText field we created earlier
3. Right Click on the Button and open "Borders and Shading"
4. On Border tab - change Presets to None
5. Click on Shading tab and select No Color then click "OK"
6. Now while your button is selected, change the button text font to "Wingdings 3" and text size to 10


Setting Rules -

1. Double click button
2. Click on Rules...
3. Click Add...
4. Rename Rule 1 to Show Section Rule
5. Click on Set Condition...
6. From field list dropdown pick HideShowButtonText field
7. Select the condition to "is equal to" and set the value part "t" again without quotes
8. Click "OK"
9. Click on "Add Action..." and pick "Set a field's value" from Action dropdown
10. Set the field to HideShowButtonText and Value to "q" without quotes
11. Make sure to check on "Stop processing rules when this rule finishes
12. Add another rule - "Hide Section Rule" as above and this time set HideShowButtonText field to "t" and allow this rule to run when HideShowButtonText = "q"

Section Toggle -

1. Right click any section on your Form which you want to hide or show based on btnToggle button clicks
2. Select "Conditional Formatting..."
3. Set the condition to HideShowButtonText is equal to "t" and make sure to check on "Hide this control"


That’s it we are done with all the required changes now click on Preview and see how you can hide and show section(s) from within InfoPath form.

Feel free to download sample Togglesection.xsn file

4 comments:

  1. works fine. Just one problem, after publish, the wingdings are gone and changed by t and q.

    ReplyDelete
  2. This is awesome. I needed to create a dropdown menu using Infopath,no code needed and your solution provided me with the idea on how to do it. Thank you very much, you saved me.

    ReplyDelete
  3. It's great and help me too much

    ReplyDelete
  4. Again, this function help me to increase my salary. Thank you so much.

    ReplyDelete