0

I have a term reference field in the format of checkboxes. However, I'd like to disallow certain combinations of checkboxes. The options are:

[]None
[]Food
[]Drinks

The "None" option is not the default none, but a taxonomy term that is actually stored in the database. I'm wondering how to allow two selections, but to disallow the selection of both "Food" and "None", or "Drinks" and "None", since in practice that really doesn't make any sense. Any suggestions?

1 Answer 1

0

Take a look at the Field Validation module, it attaches a UI where you can set custom validation rules for each field on a content type.

I am not sure whether any of the inbuilt options will work for what you want, but you can select the PHP code option and write the rules you require. There is a short reference for the PHP validator here: http://drupal.org/node/1537028

1
  • I have it installed already but hadn't thought of looking in that tab. Unfortunately, there's not an option for this built in, and I'm not sure that I'd be able to figure out how to write PHP validation for it either. Great suggestion though.
    – Mrweiner
    Commented Jul 10, 2012 at 6:12

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.