I have written some custom validation for each element in a form. I use the following method to display errors. It automatically highlights the required fields.
form_set_error('field_athletes_male', 'Athletes Male field is required.');
My problem is that there are nested element names like this:
The validation message is shown successfully but the element is not highlighted.