Skip to main content
Hi--I have an infopath form with several views connected to my workflow. For one activity, I don't want the user to be able to submit the item unless he/she has completed all the fields. Making them required in InfoPath won't help, because these fields don't need to be filled out until about 1/2 way through the process. I have been trying to do this with succeeding rules, but having no luck--basing the succeding rule on the process instance XMl fields from the infopath schema. Anyone wanna help the newbie? Thanks.....
Hi,

I had the same problem once. What I did is that I made all required fields mandatory (cannot be blank) in my InfoPath document. Then put a default value to all these controls (an asterisk for textboxes, DDLs ... / or default checkmarks for radiobuttons/checkboxes). Now use a dummy control with (e.g. "NO" as its default value). Use some rules in your InfoPath document to set this value to "Yes" after a several conditions or whatever are fulfilled. Now you can check in an OnSwitchView() event if this value is Yes, if so then delete all default values from the required mandatroy fields.

Hope that helps.
Thanks for the idea--here is what I ended up doing, based on a post at InfoPathDev. I added a field called view, and then used the onswitchview event to put the name of the view into the field:
Sub XDocument_OnSwitchView(eventObj)
XDocument.DOM.selectSingleNode("/my:IssueReporting/my:View").text = XDocument.View.Name
End Sub

Then, for my Data Validation, I have the condition if View is equal to the view I need and the field I want filled out is blank, show an error message. Works slick!
Thanks again for your reply.

The approach we use is similar to the above but without using code.
When you've created the infopath and run the K2 Infopath wizard a few fields are appeneded to your infopath dataset. One of these is the


/my:myFields/my:_K2/my:DocumentView


Which is set by the K2 Process Instance. When validating you can check that this fields value matches the View that the control you're validating is on, and voila the sameĀ result asĀ above.


The only benefit gained is that you don't introduce code.


Reply