I have not expressly done the exact use case you've requested. I recommend you look at the following blog post describing the Drupal States API, including newer additions made to that API for
For simple multiple-condition clauses the States API follows this convention:
'[field-selector]' => array('[evaluate]'),
'[field-selector2]' => array('[evaluate]'),
For more complex conditional logic you can write the following array structure:
array('[field-selector]' => array('[evaluate]')),
array('[field-selector2]' => array('[evaluate]')),
Be aware that the version of jQuery being used on your site could be important for these conditionals to work (again see the blog post).
If the above does not meet your needs I recommend you look at the Field Conditional States module:
The working states that are supported by FCS are:
- visible / invisible - Hides/Shows a form element
- enabled / disabled - Grays out a form element
- required / optional - Makes a form element required to be able to submit the form
- checked / unchecked - Checks/Unchecks a checkbox (of course only applicable to checkboxes)
Fields to which these states will be applied, are called target fields
or controled fields.
To trigger these states there is a different set of trigger states
(not to be confused with the states described above) that will trigger
a state when applied to a control field:
- empty - Triggers when the control field is empty
- filled - Triggers when the control field is not empty
- checked - Triggers when the control field is checked
- unchecked - Triggers when the control field is not checked
- value - Triggers when the control field's value is equal to a given string
- !value - Triggers when the control field's value is NOT equal to a given string
All of them are supported as long as they make any sense for the
widget of the used control field. For example it doesn't make any
sense to wait for a text field to be checked or for a checkbox to have
the value "Hello World". So most (if not all) fields will only use a
subset of these trigger states.
Note: that the states api and the field condition module are clientside modules -- they don't enforce the validation on the server. You'll likely also want to use a custom form validation function to assure that only 1 field is provided upon form submission.