Solved

Make people field required only if anything in a drop-down list is selected

  • 23 September 2022
  • 4 replies
  • 287 views

I need a rule that will make a people picker field required only if anything in a drop-down list is selected. If nothing is selected I don’t care if the person field is filled in or not. I thought I had it, but when I added a person to the field, I was still getting the “invalidate” error.  Most of the examples I have seen here are If a specific choice is selected from a drop-down then make the people field required. I just want any choice selected from the drop-down, make the people field required. This should be easy right? Ugh!

icon

Best answer by MegaJerk 23 September 2022, 17:20

View original

4 replies

Userlevel 5
Badge +14

Here is a test form with a Choice Control (named "control_Choice") and a People Picker Control (named "control_PeoplePicker"):



 


I've added a Rule to the People Picker Control:



 


The code proper:


!isNullOrEmpty(control_Choice) && isNullOrEmpty({Self})

(note: remember, if you copy and paste the code above you'll need to replace the references (black text) with your own named controls!!!)


 


When I preview the form, select a dropdown and try to save without filling out the Person field I get:




Leaving both fields blank allows me to submit the form


Leaving the Dropdown blank, but adding a person allows me to submit the form


 


Let me know if this works for you 


 

Here is a test form containing a People Picker Control and a Choice Control, both labeled "control Choice."

Thank you so much! This is perfect and so much simpler than some of them rules I have tried. I have spent hours trying to get this to work. I could kiss you! Thanks again!

Userlevel 5
Badge +14

Glad I could help! Keep coming back if you have more questions! 

Reply