Wednesday, October 19, 2011

Infopath 2010 - Switch to read-only view on submit in InfoPath


Use a rule to switch to a read-only view after submit

Add a Rule to the Submit button control on your InfoPath form template that has the following 2 Actions:
           Submit using a data connection: SharePoint Library Submit
and
         Switch to view :  View2

Use code to switch to a read-only view after submit

Add the following C# code to the Clicked event handler of the Submit button control on your InfoPath form template:
       DataConnections["SharePoint Library Submit"].Execute();
          ViewInfos.SwitchView("View 2");