I have added a custom validation handler to a node creation form that has an embedded field_collection. In the validation handler I call
<?php form_set_error("field_location", 'Please enter the primary location name.'); ?>
field_location_name is the field name of the field_collection. This does indeed work – it stops the form from submitting, displays the error, and highlights the entire field_collection container and all contained fields. The problem is that I only want to require a couple of items in the field_collection, so I've tried calling something like:
<?php form_set_error("field_location']['und']['field_location_name", 'Please enter the primary location name.'); ?>
and while the form prevents submission, this specific text field is not highlighted. Is there a way to call form_set_error on a specific field inside of a field_collection?