Posted by droople on January 18, 2008 at 8:50pm
I have 2 fields called "local tele" and "non-geo telephone" for the phone field for cck
so users can enter either a 01233 or 08xx number, or even both.
Of these 2 fields I want at least one to be mandatory when creating the node
-
so if a user doesn't enter either of the two, a "required field" error is rendered and node won't submit
-
If a user enters "local tele" then non-geo can be ignored and vice-versa
-
if user enters both fields, then both will appear on the node
thanks

Comments
Custom Validator
I had a similar thing where the user selected payment method and then depending on that some fields were mandatory. I solved the validation issue by writing a custom validator and hooking in to hook_field and hook_widget on op = 'validation'.
To make the UI look right I left the fields as not required in the form API form array and used JQuery to add the required class and span as per the theme, I did the jquery stuff in a theme method for the field.
Hope that makes sense and helps you go in a direction that works for you.