Ive added a file field to comments so users can upload a file in a comment as well as post text. How can I make it so one of the 2 fields is required to be filled in to create a comment (so you cant submit blank comments), but without making both fileds required?

1 Answer 1


Check this thread and Conditional fields module.

If you're using D7 - the principle is the same as in the thread I linked. Basically you need to attach the name of your processing function to the validation array and there perform the checks.

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.