Error message getting displayed but not getting highlighted fields in Drupal 7 Drupal 7 is not displaying highlighted fields on using form_set_error but error message is getting displayed. I have rendered my form hook_form in template. Could that be the cause for this issue?

Here is my code:

if(($form_state['values']['field1']=='' ){
 form_set_error('', t('one field is required')); 

 }
First argument of form_set_error tells Drupal what element should get highlighted. Obviously empty string means "none", so your code works exactly as designed.

To make field required, you can go a simpler way: Use #required attribute and let Drupal take care for details.

To round it off, as Clive said, your code would be: 

form_set_error('field1', t('one field is required'));


But if you're just checking for an empty field, use #required.