Limit multiple fields node add form How can I (either with a module or programmatically) limit the number of values for multiple fields? For example, the user can add only a single value for field A OR field B OR field C.
The total maximum number of values behind all fields can't exceed 1.
Using a contrib module: 
You can use the conditional_fields module.

Doing it programatically:
You can use the #states property in a custom form or form_alter hook.

You must add this to field A, B and C:

'#states' =&gt; [
  'invisible' =&gt; [
    [':input[name="field-name"]' =&gt; ['filled' =&gt; TRUE]],
    'or',
    [':input[name="field-name-2"]' =&gt; ['filled =&gt; TRUE]],
  ],
],


Of course you have to replace "field-name" and "field-name-2" with the two field names that are not the one adding the states to, hope it makes sense.

If you can’t find the name of the field you can look in the browser inspector to get the name of the input field.