I need a field allowing either a numeric value or "unlimited".
The Unlimited Number module is exactly what I want, but it's D8-only.
Is there a way to do the same thing in D7?
I need a field allowing either a numeric value or "unlimited".
The Unlimited Number module is exactly what I want, but it's D8-only.
Is there a way to do the same thing in D7?
To implement a field allowing either a numeric value or "unlimited" in D7, you can define such field using the desired widget (like a textfield maybe?). And then use the Rules module to validate the actual data that is entered before the entity (like a node or user where you use that field?) is saved (created or updated).
Some more details about the validation part of such rules to be created:
Have a look at my answer to "How to make the permissions of a module more granular?", which you can use as examples of what might be needed to implement Rules conditions as in bullets "2." or "3." above.
Of course you'd also have to pick the most appropriate Rules Event for this rule to be triggered. But there are quite a few, straight forward, events you can pick from (depending on where exactly you want to use this field), just to mention a few:
And your Rules Action is probably just a simple "Drupal set message". Though I can think of honeypot-scenarios where some specific values that got selected could result in a rules action like "block this user".
If you want even more granularity, you might also want to have a look at Conditional Rules, which allows for using "Rules Conditions" within "Rules Actions". Refer to my answer to "How to prevent a node being saved when using the Rules module?" for an illustration of using this module.