I am building a Form in InfoPath and I need to disable the submit button when the values of two controls of type PersonPicker I have are invalid. Each control holds just one user.

I tried to do a formatting rule that when the Field is invalid it will disable the button. But so far I haven't being able to determine if a PersonPicker has invalid data.

I don't have access to code, can this be achieved using the rules?

  • Can you not add validation rules :) ? sharepoint-mattharmon.blogspot.co.uk/2013/03/… Commented Nov 4, 2013 at 15:48
  • You can no add Validation Rules to a PersonPicker apparently. At least it doesn't enable me to do so.
    – Dzyann
    Commented Nov 4, 2013 at 15:56
  • Nope, no validation for people picker. Luckily, there is a solution using the double eval trick, but I need clarification on what you mean by "invalid". Is that if they have typed something into the people picker that doesn't evaluate as a person, or if they have chosen people who aren't in a particular group? Commented Nov 4, 2013 at 16:07
  • @AronFoster, by invalid I mean that they have typed something into the people picker that doesn't evaluate as a person. Thanks!
    – Dzyann
    Commented Nov 4, 2013 at 16:10

1 Answer 1


Using the double eval trick, you can create the following rule on your button to disable it until each people picker contains exactly 1 valid username:

not(xdMath:Eval(xdMath:Eval(dfs:dataFields/my:SharePointListItem_RW/my:PeoplePickerColumn/pc:Person, 'concat(pc:AccountType, ";")'), "..") = "User;" and xdMath:Eval(xdMath:Eval(dfs:dataFields/my:SharePointListItem_RW/my:PeoplePickerColumn2/pc:Person, 'concat(pc:AccountType, ";")'), "..") = "User;")

Now, this won't work by just copy pasting. You'll need to get both of the dfs:dataFields... pointing at the right field. You can use the function builder (perhaps in a calculated field that you'll use for testing) to get the right XPath. Paste the following into your formula builder:

not(eval(eval(Person, 'concat(pc:AccountType, ";")'), "..") = "User;" and eval(eval(Person, 'concat(pc:AccountType, ";")'), "..") = "User;")

Then switch to advanced field view and replace each "Person" with the "Person" reapeating group under each people picker group you want to use. Check the "Edit XPath (advanced)" box and copy the formula into your formatting rule. Sometimes pc:AccountType will be my:AccountType and I don't know why. You can add the AccountType field to your function builder to see which it is.

  • I think I didn't write my question clearly enough. I just edited. I have 2 controls PersonPicker, I want to have only one user in each of them.
    – Dzyann
    Commented Nov 4, 2013 at 16:48
  • Ah, my mistake. Let me test and change my answer to get you a working solution. Commented Nov 4, 2013 at 16:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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