Tell me more ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I am creating a browser enabled form in InfoPath that has one view of controls. THe customer prefered we use one view for ease of use. On this form I have used conditional formatting to hide fields based on role of user. As an example The Manager should only see fields to comment on performance. THe problem I am faced with is that some of these hidden fields need to be required. Another words, managers will need to fill out the data at a later date(predicted by workflow) The user that initially fills out the form won't be able to submit as InfoPath is recognizing that they are required despite being hidden from the initial user submitting form.

Maybe I need ot go back to two views :( Each role has its own view to interact with. I would like to avoid this. I was hoping I could set a rule that certain fields should only be required based on role.

share|improve this question

closed as off topic by Alex Angas Jun 2 '11 at 6:09

Questions on SharePoint Stack Exchange are expected to relate to SharePoint within the scope defined in the FAQ. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about closed questions here.

3 Answers

You could put VB or C# code-behind in the form to do the validation. You could definitely pull it off on one form that way.

share|improve this answer
Code not an option in this case. I suppose a second virw would be required. – Paul Akerlind Oct 31 '10 at 20:27
Sounds Luke the only other option. – Rob Wilson Oct 31 '10 at 23:52

(EDIT: I just realized that you asked about InfoPath 2007 and I've only worked with 2010 so I'm not sure how much of a difference there is for rules in 2007 vs 2010.)

Why not just use a validation rule that sets the hidden fields to required either when the fields are visible and/or when the role of the user is Manager?

Cheers, Bob

share|improve this answer

I would use validation rules on your fields rather than setting the cannot be blank. They are really flexible and could be setup so that the field is only required when a particular field such as WorkflowStatus is set to the desired value.

The validation rules are setup using a rule for that control and in this example checking the WorkflowStatus field for a particular value AND also that the field is blank. If so then display alidation error. The great thing about this method is you can give the user a decent error message.

If you want to detect whether the user is a manager or not then I have used a SharePoint list with two fields username and IsManager and then setup a data connection to pull the data from the list.

Once this is setup then create a field called IsManager and set this by querying the dataconnection filtering the select using the userName function, if there is a matach to the filter and the IsManager column is true then you know the user is a manager.

Simon

share|improve this answer

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