1

I have a custom field that is a radio button (from CiviCRM), and I made it available as a filter by implementing hook_views_data().

I'd like to apply a filter to show fields if the radio button is set to true; in other words, if not == false.

I feel like this should be possible without using the Views PHP module, but I have hit a wall.

0

1 Answer 1

1

Often these kind of things come back to deciding how best to bend your requirements to suit the available logic. If I understand correctly, you have a radio button with the value of true, but no other options.

My immediate thought is to change it from a radio to a checkbox and set a default value as false (unchecked).

That way you just need to check for if true or if false and you don't need to concern yourself with if not false which does get tricky.

1
  • Thanks. This is a good idea in hindsight. Actually the radio button has 2 options: "yes" and "no". Even setting a radio button default or making it "required" would fix future data entries. Unfortunately, the form and data already exist, so changing it would be a pain. It might be the least painful option though...
    – Tenz
    Commented Jan 22, 2015 at 1:43

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.