mark single form field as cause of error on form validation I've a custom field, and I'm trying to write the validation for the field values. however when a particular field causes the failure, the whole fielset is marked in red. I only want the specific field element to be highlighted, and in the case of Unlimited I only want the specific entry highlighted. 

here is the code I have so far. but the whole fieldset is marked in red when ever a validation fails. 

   function prodlist_field_widget_form(&amp;$form, &amp;$form_state, $field, $instance, $langtype, $items, $delta, $element) {
      $base = $element;

      if ($instance['widget']['type'] == 'prodlist_text') {
        $element['#element_validate'] = array('_prodlist_text_validate');


        $element['prod_type'] = array(
          '#type' =&gt; 'select',
          '#title' =&gt; t('Product Type'),
          '#default_value' =&gt; isset($items[$delta]['prod_type']) ? $items[$delta]['prod_type'] : NULL,
          '#options' =&gt; type_options(),
          ) + $base;

        $element['prod_description'] = array(
          '#type' =&gt; 'select',
          '#title' =&gt; t('Description'),
          '#default_value' =&gt; isset($items[$delta]['prod_description']) ? $items[$delta]['prod_description'] : NULL,
          '#options' =&gt; description_options(),
          ) + $base;

        $element['order_amount'] = array(
          '#type' =&gt; 'textfield',
          '#title' =&gt; t('Amount'),
          '#default_value' =&gt; isset($items[$delta]['order_amount']) ? $items[$delta]['order_amount'] : NULL) + $base;
      }
      return $element;

    }


function _prodlist_text_validate($element, &amp;$form_state) {

  if ($form_state['complete form']['#form_id'] == 'field_ui_field_edit_form') {
    return ;
  }

  $values = $form_state['values'];
  $language = $values['language'];
  $field_name = $element['#field_name'];
  $field_name_error_box = $field_name;

  foreach ($values[$field_name][$language] as $delta =&gt; $item) {

    if (isset($item['order_amount'])) {

      if (is_numeric($item['order_amount'])) {
        if($item['prod_description'] != 'no order' &amp;&amp; $item['order_amount'] &lt;= 0 ){
          form_set_error($field_name_error_box, t('Order amount has to be more then 0'));
        } else if ($item['prod_description'] == 'no order' &amp;&amp; $item['order_amount'] &gt; 0) {
          form_set_error($field_name_error_box, t('You have created an order amount without selecting a product.'));
        }


      } else {
        form_set_error($field_name_error_box, t('Order amount has to be numeric'));
      }
   }

  }

}


I'm trying to set the variable $field_name_error_box = $field_name; to the correct value but it either lights up the whole form section or nothing at all. 

I've tried the following, and lots of other variants without luck.

$field_name_error_box = $field_name . 'order_amount';
You must use a field name like this:  'parent][element'

In your case,

$field_name_error_box = $field_name . '][order_amount';


should work.