How to validate taxonomy term field with a Rule?

Events happening in the community are now at Drupal community events on www.drupal.org.
autodidactic's picture

I need some help understanding how to validate taxonomy terms associated with a node. I have two taxonomy term fields based off of the same vocabulary. One field is for the user and the other is for a content type. I'd like to validate the node field against the user field. I want to throw an error if the user selected something that is not also selected in the user field.

User Field:
City 1 - checked
City 2
City 3
City 4 - checked

Node Field:
City 1 - checked
City 2 - checked(this should cause an error message and not save the node)
City 3
City 4 - checked

The closest I could get:
Event:
"Before saving content"

Conditions:
"Data comparison" - Parameter: Data to compare: [node:field-city], Data value: [site:current-user:field-city]

Actions:
"Show a message on the site"

Looking through the Rules UI and online tutorials I've found the "List contains item" and the "data comparison" conditions but they don't quite do what I need. I can't find a way to loop through the node field's items dynamically without explicitly specifying the actual value. Can this be done with the pre-baked options or do I have to resort to custom PHP?

Rules

Group organizers

Group categories

Categories

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: