1

I have a field on a content type which is an optional override for another field. I want the value to only be either 0, 1, or empty, the last meaning "no override". What field type should I use for this? I was looking at a select list for a good user experience, but I was unable to get empty as a value in the list.

I also need another field that can only have values "img", "txt" or "". How should I accomplish this? I want to avoid having users type in "img" or "txt" in case they misspell it.

1
  • 1
    I asked about similar thing and I'm in (damn slow) process of making a module for it. Just FYI. There is no ready made tri-state control in Drupal now, except lists with 3 values (or not-required ones with 2).
    – Mołot
    Commented Jun 12, 2013 at 7:00

1 Answer 1

3

Select lists have always the option None if they are not set as Required. That said, you can create a List (Text) field with select list widget and set only two options, 0 and 1, and you will get the None option automatically.

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.